<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GDBusConnection</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="gdbus-lowlevel.html" title="Lowlevel D-Bus Support">
<link rel="prev" href="GDBusMessage.html" title="GDBusMessage">
<link rel="next" href="GDBusMethodInvocation.html" title="GDBusMethodInvocation">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="GDBusMessage.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="gdbus-lowlevel.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GIO Reference Manual</th>
<td><a accesskey="n" href="GDBusMethodInvocation.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#GDBusConnection.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#GDBusConnection.description" class="shortcut">Description</a>
                   | 
                  <a href="#GDBusConnection.object-hierarchy" class="shortcut">Object Hierarchy</a>
                   | 
                  <a href="#GDBusConnection.implemented-interfaces" class="shortcut">Implemented Interfaces</a>
                   | 
                  <a href="#GDBusConnection.properties" class="shortcut">Properties</a>
                   | 
                  <a href="#GDBusConnection.signals" class="shortcut">Signals</a>
</td></tr>
</table>
<div class="refentry">
<a name="GDBusConnection"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GDBusConnection.top_of_page"></a>GDBusConnection</span></h2>
<p>GDBusConnection — D-Bus Connections</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="GDBusConnection.synopsis"></a><h2>Synopsis</h2>
<a name="GBusType"></a><a name="GDBusConnectionFlags"></a><a name="GDBusCapabilityFlags"></a><pre class="synopsis">
#include &lt;gio/gio.h&gt;

enum                <a class="link" href="GDBusConnection.html#GBusType">GBusType</a>;
<span class="returnvalue">void</span>                <a class="link" href="GDBusConnection.html#g-bus-get" title="g_bus_get ()">g_bus_get</a>                           (<em class="parameter"><code><a class="link" href="GDBusConnection.html#GBusType"><span class="type">GBusType</span></a> bus_type</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   <a class="link" href="GDBusConnection.html#g-bus-get-finish" title="g_bus_get_finish ()">g_bus_get_finish</a>                    (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   <a class="link" href="GDBusConnection.html#g-bus-get-sync" title="g_bus_get_sync ()">g_bus_get_sync</a>                      (<em class="parameter"><code><a class="link" href="GDBusConnection.html#GBusType"><span class="type">GBusType</span></a> bus_type</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
                    <a class="link" href="GDBusConnection.html#GDBusConnection-struct" title="GDBusConnection">GDBusConnection</a>;
enum                <a class="link" href="GDBusConnection.html#GDBusConnectionFlags">GDBusConnectionFlags</a>;
<span class="returnvalue">void</span>                <a class="link" href="GDBusConnection.html#g-dbus-connection-new" title="g_dbus_connection_new ()">g_dbus_connection_new</a>               (<em class="parameter"><code><a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a> *stream</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *guid</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusConnectionFlags"><span class="type">GDBusConnectionFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> *observer</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   <a class="link" href="GDBusConnection.html#g-dbus-connection-new-finish" title="g_dbus_connection_new_finish ()">g_dbus_connection_new_finish</a>        (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   <a class="link" href="GDBusConnection.html#g-dbus-connection-new-sync" title="g_dbus_connection_new_sync ()">g_dbus_connection_new_sync</a>          (<em class="parameter"><code><a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a> *stream</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *guid</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusConnectionFlags"><span class="type">GDBusConnectionFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> *observer</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GDBusConnection.html#g-dbus-connection-new-for-address" title="g_dbus_connection_new_for_address ()">g_dbus_connection_new_for_address</a>   (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *address</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusConnectionFlags"><span class="type">GDBusConnectionFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> *observer</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   <a class="link" href="GDBusConnection.html#g-dbus-connection-new-for-address-finish" title="g_dbus_connection_new_for_address_finish ()">g_dbus_connection_new_for_address_finish</a>
                                                        (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   <a class="link" href="GDBusConnection.html#g-dbus-connection-new-for-address-sync" title="g_dbus_connection_new_for_address_sync ()">g_dbus_connection_new_for_address_sync</a>
                                                        (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *address</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusConnectionFlags"><span class="type">GDBusConnectionFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> *observer</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GDBusConnection.html#g-dbus-connection-start-message-processing" title="g_dbus_connection_start_message_processing ()">g_dbus_connection_start_message_processing</a>
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GDBusConnection.html#g-dbus-connection-close" title="g_dbus_connection_close ()">g_dbus_connection_close</a>             (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GDBusConnection.html#g-dbus-connection-close-finish" title="g_dbus_connection_close_finish ()">g_dbus_connection_close_finish</a>      (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GDBusConnection.html#g-dbus-connection-close-sync" title="g_dbus_connection_close_sync ()">g_dbus_connection_close_sync</a>        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GDBusConnection.html#g-dbus-connection-is-closed" title="g_dbus_connection_is_closed ()">g_dbus_connection_is_closed</a>         (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GDBusConnection.html#g-dbus-connection-flush" title="g_dbus_connection_flush ()">g_dbus_connection_flush</a>             (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GDBusConnection.html#g-dbus-connection-flush-finish" title="g_dbus_connection_flush_finish ()">g_dbus_connection_flush_finish</a>      (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GDBusConnection.html#g-dbus-connection-flush-sync" title="g_dbus_connection_flush_sync ()">g_dbus_connection_flush_sync</a>        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GDBusConnection.html#g-dbus-connection-get-exit-on-close" title="g_dbus_connection_get_exit_on_close ()">g_dbus_connection_get_exit_on_close</a> (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GDBusConnection.html#g-dbus-connection-set-exit-on-close" title="g_dbus_connection_set_exit_on_close ()">g_dbus_connection_set_exit_on_close</a> (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> exit_on_close</code></em>);
<a class="link" href="GIOStream.html" title="GIOStream"><span class="returnvalue">GIOStream</span></a> *         <a class="link" href="GDBusConnection.html#g-dbus-connection-get-stream" title="g_dbus_connection_get_stream ()">g_dbus_connection_get_stream</a>        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);
const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       <a class="link" href="GDBusConnection.html#g-dbus-connection-get-guid" title="g_dbus_connection_get_guid ()">g_dbus_connection_get_guid</a>          (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);
const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       <a class="link" href="GDBusConnection.html#g-dbus-connection-get-unique-name" title="g_dbus_connection_get_unique_name ()">g_dbus_connection_get_unique_name</a>   (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);
enum                <a class="link" href="GDBusConnection.html#GDBusCapabilityFlags">GDBusCapabilityFlags</a>;
<a class="link" href="GDBusConnection.html#GDBusCapabilityFlags"><span class="returnvalue">GDBusCapabilityFlags</span></a>  <a class="link" href="GDBusConnection.html#g-dbus-connection-get-capabilities" title="g_dbus_connection_get_capabilities ()">g_dbus_connection_get_capabilities</a>
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);
<a class="link" href="GCredentials.html" title="GCredentials"><span class="returnvalue">GCredentials</span></a> *      <a class="link" href="GDBusConnection.html#g-dbus-connection-get-peer-credentials" title="g_dbus_connection_get_peer_credentials ()">g_dbus_connection_get_peer_credentials</a>
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);
enum                <a class="link" href="GDBusConnection.html#GDBusCallFlags" title="enum GDBusCallFlags">GDBusCallFlags</a>;
<span class="returnvalue">void</span>                <a class="link" href="GDBusConnection.html#g-dbus-connection-call" title="g_dbus_connection_call ()">g_dbus_connection_call</a>              (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *bus_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *method_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameters</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *reply_type</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusCallFlags" title="enum GDBusCallFlags"><span class="type">GDBusCallFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> timeout_msec</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="returnvalue">GVariant</span></a> *          <a class="link" href="GDBusConnection.html#g-dbus-connection-call-finish" title="g_dbus_connection_call_finish ()">g_dbus_connection_call_finish</a>       (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="returnvalue">GVariant</span></a> *          <a class="link" href="GDBusConnection.html#g-dbus-connection-call-sync" title="g_dbus_connection_call_sync ()">g_dbus_connection_call_sync</a>         (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *bus_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *method_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameters</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *reply_type</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusCallFlags" title="enum GDBusCallFlags"><span class="type">GDBusCallFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> timeout_msec</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GDBusConnection.html#g-dbus-connection-emit-signal" title="g_dbus_connection_emit_signal ()">g_dbus_connection_emit_signal</a>       (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *destination_bus_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *signal_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameters</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
enum                <a class="link" href="GDBusConnection.html#GDBusSignalFlags" title="enum GDBusSignalFlags">GDBusSignalFlags</a>;
<span class="returnvalue">void</span>                (<a class="link" href="GDBusConnection.html#GDBusSignalCallback" title="GDBusSignalCallback ()">*GDBusSignalCallback</a>)              (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *signal_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameters</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               <a class="link" href="GDBusConnection.html#g-dbus-connection-signal-subscribe" title="g_dbus_connection_signal_subscribe ()">g_dbus_connection_signal_subscribe</a>  (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *member</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *arg0</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusSignalFlags" title="enum GDBusSignalFlags"><span class="type">GDBusSignalFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusSignalCallback" title="GDBusSignalCallback ()"><span class="type">GDBusSignalCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> user_data_free_func</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GDBusConnection.html#g-dbus-connection-signal-unsubscribe" title="g_dbus_connection_signal_unsubscribe ()">g_dbus_connection_signal_unsubscribe</a>
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> subscription_id</code></em>);
enum                <a class="link" href="GDBusConnection.html#GDBusSendMessageFlags" title="enum GDBusSendMessageFlags">GDBusSendMessageFlags</a>;
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GDBusConnection.html#g-dbus-connection-send-message" title="g_dbus_connection_send_message ()">g_dbus_connection_send_message</a>      (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> *message</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusSendMessageFlags" title="enum GDBusSendMessageFlags"><span class="type">GDBusSendMessageFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code>volatile <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> *out_serial</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GDBusConnection.html#g-dbus-connection-send-message-with-reply" title="g_dbus_connection_send_message_with_reply ()">g_dbus_connection_send_message_with_reply</a>
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> *message</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusSendMessageFlags" title="enum GDBusSendMessageFlags"><span class="type">GDBusSendMessageFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> timeout_msec</code></em>,
                                                         <em class="parameter"><code>volatile <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> *out_serial</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="returnvalue">GDBusMessage</span></a> *      <a class="link" href="GDBusConnection.html#g-dbus-connection-send-message-with-reply-finish" title="g_dbus_connection_send_message_with_reply_finish ()">g_dbus_connection_send_message_with_reply_finish</a>
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="returnvalue">GDBusMessage</span></a> *      <a class="link" href="GDBusConnection.html#g-dbus-connection-send-message-with-reply-sync" title="g_dbus_connection_send_message_with_reply_sync ()">g_dbus_connection_send_message_with_reply_sync</a>
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> *message</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusSendMessageFlags" title="enum GDBusSendMessageFlags"><span class="type">GDBusSendMessageFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> timeout_msec</code></em>,
                                                         <em class="parameter"><code>volatile <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> *out_serial</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="returnvalue">GDBusMessage</span></a> *      (<a class="link" href="GDBusConnection.html#GDBusMessageFilterFunction" title="GDBusMessageFilterFunction ()">*GDBusMessageFilterFunction</a>)       (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> *message</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> incoming</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               <a class="link" href="GDBusConnection.html#g-dbus-connection-add-filter" title="g_dbus_connection_add_filter ()">g_dbus_connection_add_filter</a>        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusMessageFilterFunction" title="GDBusMessageFilterFunction ()"><span class="type">GDBusMessageFilterFunction</span></a> filter_function</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> user_data_free_func</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GDBusConnection.html#g-dbus-connection-remove-filter" title="g_dbus_connection_remove_filter ()">g_dbus_connection_remove_filter</a>     (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> filter_id</code></em>);
                    <a class="link" href="GDBusConnection.html#GDBusInterfaceVTable" title="GDBusInterfaceVTable">GDBusInterfaceVTable</a>;
<span class="returnvalue">void</span>                (<a class="link" href="GDBusConnection.html#GDBusInterfaceMethodCallFunc" title="GDBusInterfaceMethodCallFunc ()">*GDBusInterfaceMethodCallFunc</a>)     (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *method_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameters</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusMethodInvocation.html" title="GDBusMethodInvocation"><span class="type">GDBusMethodInvocation</span></a> *invocation</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="returnvalue">GVariant</span></a> *          (<a class="link" href="GDBusConnection.html#GDBusInterfaceGetPropertyFunc" title="GDBusInterfaceGetPropertyFunc ()">*GDBusInterfaceGetPropertyFunc</a>)    (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *property_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            (<a class="link" href="GDBusConnection.html#GDBusInterfaceSetPropertyFunc" title="GDBusInterfaceSetPropertyFunc ()">*GDBusInterfaceSetPropertyFunc</a>)    (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *property_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *value</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               <a class="link" href="GDBusConnection.html#g-dbus-connection-register-object" title="g_dbus_connection_register_object ()">g_dbus_connection_register_object</a>   (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-D-Bus-Introspection-Data.html#GDBusInterfaceInfo"><span class="type">GDBusInterfaceInfo</span></a> *interface_info</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="GDBusConnection.html#GDBusInterfaceVTable" title="GDBusInterfaceVTable"><span class="type">GDBusInterfaceVTable</span></a> *vtable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> user_data_free_func</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GDBusConnection.html#g-dbus-connection-unregister-object" title="g_dbus_connection_unregister_object ()">g_dbus_connection_unregister_object</a> (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> registration_id</code></em>);
                    <a class="link" href="GDBusConnection.html#GDBusSubtreeVTable" title="GDBusSubtreeVTable">GDBusSubtreeVTable</a>;
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> **            (<a class="link" href="GDBusConnection.html#GDBusSubtreeEnumerateFunc" title="GDBusSubtreeEnumerateFunc ()">*GDBusSubtreeEnumerateFunc</a>)        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<a class="link" href="gio-D-Bus-Introspection-Data.html#GDBusInterfaceInfo"><span class="returnvalue">GDBusInterfaceInfo</span></a> ** (<a class="link" href="GDBusConnection.html#GDBusSubtreeIntrospectFunc" title="GDBusSubtreeIntrospectFunc ()">*GDBusSubtreeIntrospectFunc</a>)     (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *node</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
const <a class="link" href="GDBusConnection.html#GDBusInterfaceVTable" title="GDBusInterfaceVTable"><span class="returnvalue">GDBusInterfaceVTable</span></a> * (<a class="link" href="GDBusConnection.html#GDBusSubtreeDispatchFunc" title="GDBusSubtreeDispatchFunc ()">*GDBusSubtreeDispatchFunc</a>)
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *node</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> *out_user_data</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
enum                <a class="link" href="GDBusConnection.html#GDBusSubtreeFlags" title="enum GDBusSubtreeFlags">GDBusSubtreeFlags</a>;
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               <a class="link" href="GDBusConnection.html#g-dbus-connection-register-subtree" title="g_dbus_connection_register_subtree ()">g_dbus_connection_register_subtree</a>  (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="GDBusConnection.html#GDBusSubtreeVTable" title="GDBusSubtreeVTable"><span class="type">GDBusSubtreeVTable</span></a> *vtable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusSubtreeFlags" title="enum GDBusSubtreeFlags"><span class="type">GDBusSubtreeFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> user_data_free_func</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GDBusConnection.html#g-dbus-connection-unregister-subtree" title="g_dbus_connection_unregister_subtree ()">g_dbus_connection_unregister_subtree</a>
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> registration_id</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="GDBusConnection.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
  GEnum
   +----GBusType
</pre>
<pre class="synopsis">
  <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
   +----GDBusConnection
</pre>
<pre class="synopsis">
  GFlags
   +----GDBusConnectionFlags
</pre>
<pre class="synopsis">
  GFlags
   +----GDBusCapabilityFlags
</pre>
</div>
<div class="refsect1">
<a name="GDBusConnection.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GDBusConnection implements
 <a class="link" href="GInitable.html" title="GInitable">GInitable</a> and  <a class="link" href="GAsyncInitable.html" title="GAsyncInitable">GAsyncInitable</a>.</p>
</div>
<div class="refsect1">
<a name="GDBusConnection.properties"></a><h2>Properties</h2>
<pre class="synopsis">
  "<a class="link" href="GDBusConnection.html#GDBusConnection--address" title='The "address" property'>address</a>"                  <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Write / Construct Only
  "<a class="link" href="GDBusConnection.html#GDBusConnection--authentication-observer" title='The "authentication-observer" property'>authentication-observer</a>"  <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a>*    : Write / Construct Only
  "<a class="link" href="GDBusConnection.html#GDBusConnection--capabilities" title='The "capabilities" property'>capabilities</a>"             <a class="link" href="GDBusConnection.html#GDBusCapabilityFlags"><span class="type">GDBusCapabilityFlags</span></a>  : Read
  "<a class="link" href="GDBusConnection.html#GDBusConnection--closed" title='The "closed" property'>closed</a>"                   <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read
  "<a class="link" href="GDBusConnection.html#GDBusConnection--exit-on-close" title='The "exit-on-close" property'>exit-on-close</a>"            <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write
  "<a class="link" href="GDBusConnection.html#GDBusConnection--flags" title='The "flags" property'>flags</a>"                    <a class="link" href="GDBusConnection.html#GDBusConnectionFlags"><span class="type">GDBusConnectionFlags</span></a>  : Write / Construct Only
  "<a class="link" href="GDBusConnection.html#GDBusConnection--guid" title='The "guid" property'>guid</a>"                     <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read / Write / Construct Only
  "<a class="link" href="GDBusConnection.html#GDBusConnection--stream" title='The "stream" property'>stream</a>"                   <a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a>*            : Read / Write / Construct Only
  "<a class="link" href="GDBusConnection.html#GDBusConnection--unique-name" title='The "unique-name" property'>unique-name</a>"              <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read
</pre>
</div>
<div class="refsect1">
<a name="GDBusConnection.signals"></a><h2>Signals</h2>
<pre class="synopsis">
  "<a class="link" href="GDBusConnection.html#GDBusConnection-closed" title='The "closed" signal'>closed</a>"                                         : <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a>
</pre>
</div>
<div class="refsect1">
<a name="GDBusConnection.description"></a><h2>Description</h2>
<p>
The <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> type is used for D-Bus connections to remote
peers such as a message buses. It is a low-level API that offers a
lot of flexibility. For instance, it lets you establish a connection
over any transport that can by represented as an <a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a>.
</p>
<p>
This class is rarely used directly in D-Bus clients. If you are writing
an D-Bus client, it is often easier to use the <a class="link" href="gio-Owning-Bus-Names.html#g-bus-own-name" title="g_bus_own_name ()"><code class="function">g_bus_own_name()</code></a>,
<a class="link" href="gio-Watching-Bus-Names.html#g-bus-watch-name" title="g_bus_watch_name ()"><code class="function">g_bus_watch_name()</code></a> or <a class="link" href="GDBusProxy.html#g-dbus-proxy-new-for-bus" title="g_dbus_proxy_new_for_bus ()"><code class="function">g_dbus_proxy_new_for_bus()</code></a> APIs.
</p>
<p>
</p>
<div class="example">
<a name="gdbus-server"></a><p class="title"><b>Example 2. D-Bus server example</b></p>
<div class="example-contents">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;gio/gio.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;stdlib.h&gt;</span>

<span class="preproc">#ifdef</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#G-OS-UNIX:CAPS">G_OS_UNIX</a></span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;gio/gunixfdlist.h&gt;</span>
<span class="comment">/* For STDOUT_FILENO */</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;unistd.h&gt;</span>
<span class="preproc">#endif</span>

<span class="comment">/* ---------------------------------------------------------------------------------------------------- */</span>

<span class="keyword">static</span><span class="normal"> </span><span class="usertype">GDBusNodeInfo</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">introspection_data </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>

<span class="comment">/* Introspection data for the service we are exporting */</span>
<span class="keyword">static</span><span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> introspection_xml</span><span class="symbol">[]</span><span class="normal"> </span><span class="symbol">=</span>
<span class="normal">  </span><span class="string">"&lt;node&gt;"</span>
<span class="normal">  </span><span class="string">"  &lt;interface name='org.gtk.GDBus.TestInterface'&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;annotation name='org.gtk.GDBus.Annotation' value='OnInterface'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;annotation name='org.gtk.GDBus.Annotation' value='AlsoOnInterface'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;method name='HelloWorld'&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;annotation name='org.gtk.GDBus.Annotation' value='OnMethod'/&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;arg type='s' name='greeting' direction='in'/&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;arg type='s' name='response' direction='out'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;/method&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;method name='EmitSignal'&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;arg type='d' name='speed_in_mph' direction='in'&gt;"</span>
<span class="normal">  </span><span class="string">"        &lt;annotation name='org.gtk.GDBus.Annotation' value='OnArg'/&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;/arg&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;/method&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;method name='GimmeStdout'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;signal name='VelocityChanged'&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;annotation name='org.gtk.GDBus.Annotation' value='Onsignal'/&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;arg type='d' name='speed_in_mph'/&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;arg type='s' name='speed_as_string'&gt;"</span>
<span class="normal">  </span><span class="string">"        &lt;annotation name='org.gtk.GDBus.Annotation' value='OnArg_NonFirst'/&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;/arg&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;/signal&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='s' name='FluxCapicitorName' access='read'&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;annotation name='org.gtk.GDBus.Annotation' value='OnProperty'&gt;"</span>
<span class="normal">  </span><span class="string">"        &lt;annotation name='org.gtk.GDBus.Annotation' value='OnAnnotation_YesThisIsCrazy'/&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;/annotation&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;/property&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='s' name='Title' access='readwrite'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='s' name='ReadingAlwaysThrowsError' access='read'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='s' name='WritingAlwaysThrowsError' access='readwrite'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='s' name='OnlyWritable' access='write'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='s' name='Foo' access='read'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='s' name='Bar' access='read'/&gt;"</span>
<span class="normal">  </span><span class="string">"  &lt;/interface&gt;"</span>
<span class="normal">  </span><span class="string">"&lt;/node&gt;"</span><span class="symbol">;</span>

<span class="comment">/* ---------------------------------------------------------------------------------------------------- */</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">handle_method_call</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">       </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">interface_name</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">method_name</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="usertype">GVariant</span><span class="normal">              </span><span class="symbol">*</span><span class="normal">parameters</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="usertype">GDBusMethodInvocation</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="usertype">gpointer</span><span class="normal">               user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"HelloWorld"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">greeting</span><span class="symbol">;</span>

<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">parameters</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"(&amp;s)"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">greeting</span><span class="symbol">);</span>

<span class="normal">      </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">greeting</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Return Unregistered"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">        </span><span class="cbracket">{</span>
<span class="normal">          </span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-return-error">g_dbus_method_invocation_return_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                                                 <a href="gio-GIOError.html#G-IO-ERROR:CAPS">G_IO_ERROR</a></span><span class="symbol">,</span>
<span class="normal">                                                 <a href="gio-GIOError.html#G-IO-ERROR-FAILED-HANDLED:CAPS">G_IO_ERROR_FAILED_HANDLED</a></span><span class="symbol">,</span>
<span class="normal">                                                 </span><span class="string">"As requested, here's a GError not registered (G_IO_ERROR_FAILED_HANDLED)"</span><span class="symbol">);</span>
<span class="normal">        </span><span class="cbracket">}</span>
<span class="normal">      </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">greeting</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Return Registered"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">        </span><span class="cbracket">{</span>
<span class="normal">          </span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-return-error">g_dbus_method_invocation_return_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                                                 <a href="GDBusError.html#G-DBUS-ERROR:CAPS">G_DBUS_ERROR</a></span><span class="symbol">,</span>
<span class="normal">                                                 <a href="GDBusError.html#G-DBUS-ERROR-MATCH-RULE-NOT-FOUND:CAPS">G_DBUS_ERROR_MATCH_RULE_NOT_FOUND</a></span><span class="symbol">,</span>
<span class="normal">                                                 </span><span class="string">"As requested, here's a GError that is registered (G_DBUS_ERROR_MATCH_RULE_NOT_FOUND)"</span><span class="symbol">);</span>
<span class="normal">        </span><span class="cbracket">}</span>
<span class="normal">      </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">greeting</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Return Raw"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">        </span><span class="cbracket">{</span>
<span class="normal">          </span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-return-dbus-error">g_dbus_method_invocation_return_dbus_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                                                      </span><span class="string">"org.gtk.GDBus.SomeErrorName"</span><span class="symbol">,</span>
<span class="normal">                                                      </span><span class="string">"As requested, here's a raw D-Bus error"</span><span class="symbol">);</span>
<span class="normal">        </span><span class="cbracket">}</span>
<span class="normal">      </span><span class="keyword">else</span>
<span class="normal">        </span><span class="cbracket">{</span>
<span class="normal">          </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">response</span><span class="symbol">;</span>
<span class="normal">          response </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup-printf">g_strdup_printf</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"You greeted me with '%s'. Thanks!"</span><span class="symbol">,</span><span class="normal"> greeting</span><span class="symbol">);</span>
<span class="normal">          </span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-return-value">g_dbus_method_invocation_return_value</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                                                 </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(s)"</span><span class="symbol">,</span><span class="normal"> response</span><span class="symbol">));</span>
<span class="normal">          </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">response</span><span class="symbol">);</span>
<span class="normal">        </span><span class="cbracket">}</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"EmitSignal"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">local_error</span><span class="symbol">;</span>
<span class="normal">      </span><span class="usertype">gdouble</span><span class="normal"> speed_in_mph</span><span class="symbol">;</span>
<span class="normal">      </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">speed_as_string</span><span class="symbol">;</span>

<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">parameters</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"(d)"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">speed_in_mph</span><span class="symbol">);</span>
<span class="normal">      speed_as_string </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup-printf">g_strdup_printf</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"%g mph!"</span><span class="symbol">,</span><span class="normal"> speed_in_mph</span><span class="symbol">);</span>

<span class="normal">      local_error </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">      </span><span class="function"><a href="GDBusConnection.html#g-dbus-connection-emit-signal">g_dbus_connection_emit_signal</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                                     <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                                     object_path</span><span class="symbol">,</span>
<span class="normal">                                     interface_name</span><span class="symbol">,</span>
<span class="normal">                                     </span><span class="string">"VelocityChanged"</span><span class="symbol">,</span>
<span class="normal">                                     </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(ds)"</span><span class="symbol">,</span>
<span class="normal">                                                    speed_in_mph</span><span class="symbol">,</span>
<span class="normal">                                                    speed_as_string</span><span class="symbol">),</span>
<span class="normal">                                     </span><span class="symbol">&amp;</span><span class="normal">local_error</span><span class="symbol">);</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-no-error">g_assert_no_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">local_error</span><span class="symbol">);</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">speed_as_string</span><span class="symbol">);</span>

<span class="normal">      </span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-return-value">g_dbus_method_invocation_return_value</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"GimmeStdout"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="preproc">#ifdef</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#G-OS-UNIX:CAPS">G_OS_UNIX</a></span>
<span class="normal">      </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GDBusConnection.html#g-dbus-connection-get-capabilities">g_dbus_connection_get_capabilities</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal"> <a href="GDBusConnection.html#G-DBUS-CAPABILITY-FLAGS-UNIX-FD-PASSING:CAPS">G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING</a></span><span class="symbol">)</span>
<span class="normal">        </span><span class="cbracket">{</span>
<span class="normal">          </span><span class="usertype">GDBusMessage</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">reply</span><span class="symbol">;</span>
<span class="normal">          </span><span class="usertype">GUnixFDList</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">fd_list</span><span class="symbol">;</span>
<span class="normal">          </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error</span><span class="symbol">;</span>

<span class="normal">          fd_list </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GUnixFDList.html#g-unix-fd-list-new">g_unix_fd_list_new</a></span><span class="normal"> </span><span class="symbol">();</span>
<span class="normal">          error </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">          </span><span class="function"><a href="GUnixFDList.html#g-unix-fd-list-append">g_unix_fd_list_append</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">fd_list</span><span class="symbol">,</span><span class="normal"> STDOUT_FILENO</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal">          </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-no-error">g_assert_no_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>

<span class="normal">          reply </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDBusMessage.html#g-dbus-message-new-method-reply">g_dbus_message_new_method_reply</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-get-message">g_dbus_method_invocation_get_message</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">));</span>
<span class="normal">          </span><span class="function"><a href="GDBusMessage.html#g-dbus-message-set-unix-fd-list">g_dbus_message_set_unix_fd_list</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">reply</span><span class="symbol">,</span><span class="normal"> fd_list</span><span class="symbol">);</span>

<span class="normal">          error </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">          </span><span class="function"><a href="GDBusConnection.html#g-dbus-connection-send-message">g_dbus_connection_send_message</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                                          reply</span><span class="symbol">,</span>
<span class="normal">                                          <a href="GDBusConnection.html#G-DBUS-SEND-MESSAGE-FLAGS-NONE:CAPS">G_DBUS_SEND_MESSAGE_FLAGS_NONE</a></span><span class="symbol">,</span>
<span class="normal">                                          <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="comment">/* out_serial */</span>
<span class="normal">                                          </span><span class="symbol">&amp;</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal">          </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-no-error">g_assert_no_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>

<span class="normal">          </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">);</span>
<span class="normal">          </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">fd_list</span><span class="symbol">);</span>
<span class="normal">          </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">reply</span><span class="symbol">);</span>
<span class="normal">        </span><span class="cbracket">}</span>
<span class="normal">      </span><span class="keyword">else</span>
<span class="normal">        </span><span class="cbracket">{</span>
<span class="normal">          </span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-return-dbus-error">g_dbus_method_invocation_return_dbus_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                                                      </span><span class="string">"org.gtk.GDBus.Failed"</span><span class="symbol">,</span>
<span class="normal">                                                      </span><span class="string">"Your message bus daemon does not support file descriptor passing (need D-Bus &gt;= 1.3.0)"</span><span class="symbol">);</span>
<span class="normal">        </span><span class="cbracket">}</span>
<span class="preproc">#else</span>
<span class="normal">      </span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-return-dbus-error">g_dbus_method_invocation_return_dbus_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                                                  </span><span class="string">"org.gtk.GDBus.NotOnUnix"</span><span class="symbol">,</span>
<span class="normal">                                                  </span><span class="string">"Your OS does not support file descriptor passing"</span><span class="symbol">);</span>
<span class="preproc">#endif</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar">gchar</a> </span><span class="symbol">*</span><span class="normal">_global_title </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>

<span class="keyword">static</span><span class="normal"> </span><span class="usertype">gboolean</span><span class="normal"> swap_a_and_b </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">;</span>

<span class="keyword">static</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant">GVariant</a> </span><span class="symbol">*</span>
<span class="function">handle_get_property</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">  </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">interface_name</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">property_name</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">GError</span><span class="normal">          </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">gpointer</span><span class="normal">          user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">ret</span><span class="symbol">;</span>

<span class="normal">  ret </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"FluxCapicitorName"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      ret </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"DeLorean"</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Title"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">_global_title </span><span class="symbol">==</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span>
<span class="normal">        _global_title </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Back To C!"</span><span class="symbol">);</span>
<span class="normal">      ret </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">_global_title</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"ReadingAlwaysThrowsError"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#g-set-error">g_set_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">,</span>
<span class="normal">                   <a href="gio-GIOError.html#G-IO-ERROR:CAPS">G_IO_ERROR</a></span><span class="symbol">,</span>
<span class="normal">                   <a href="gio-GIOError.html#G-IO-ERROR-FAILED:CAPS">G_IO_ERROR_FAILED</a></span><span class="symbol">,</span>
<span class="normal">                   </span><span class="string">"Hello %s. I thought I said reading this property "</span>
<span class="normal">                   </span><span class="string">"always results in an error. kthxbye"</span><span class="symbol">,</span>
<span class="normal">                   sender</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"WritingAlwaysThrowsError"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      ret </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"There's no home like home"</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Foo"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      ret </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">swap_a_and_b </span><span class="symbol">?</span><span class="normal"> </span><span class="string">"Tock"</span><span class="normal"> </span><span class="symbol">:</span><span class="normal"> </span><span class="string">"Tick"</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Bar"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      ret </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">swap_a_and_b </span><span class="symbol">?</span><span class="normal"> </span><span class="string">"Tick"</span><span class="normal"> </span><span class="symbol">:</span><span class="normal"> </span><span class="string">"Tock"</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> ret</span><span class="symbol">;</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean">gboolean</a></span>
<span class="function">handle_set_property</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">  </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">interface_name</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">property_name</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">GVariant</span><span class="normal">         </span><span class="symbol">*</span><span class="normal">value</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">GError</span><span class="normal">          </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">gpointer</span><span class="normal">          user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Title"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">_global_title</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-string">g_variant_get_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">))</span><span class="normal"> </span><span class="symbol">!=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">        </span><span class="cbracket">{</span>
<span class="normal">          </span><span class="usertype">GVariantBuilder</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">builder</span><span class="symbol">;</span>
<span class="normal">          </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">local_error</span><span class="symbol">;</span>

<span class="normal">          </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">_global_title</span><span class="symbol">);</span>
<span class="normal">          _global_title </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-dup-string">g_variant_dup_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="normal">          local_error </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">          builder </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-builder-new">g_variant_builder_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#G-VARIANT-TYPE-ARRAY:CAPS">G_VARIANT_TYPE_ARRAY</a></span><span class="symbol">);</span>
<span class="normal">          </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">builder</span><span class="symbol">,</span>
<span class="normal">                                 </span><span class="string">"{sv}"</span><span class="symbol">,</span>
<span class="normal">                                 </span><span class="string">"Title"</span><span class="symbol">,</span>
<span class="normal">                                 </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">_global_title</span><span class="symbol">));</span>
<span class="normal">          </span><span class="function"><a href="GDBusConnection.html#g-dbus-connection-emit-signal">g_dbus_connection_emit_signal</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                                         <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                                         object_path</span><span class="symbol">,</span>
<span class="normal">                                         </span><span class="string">"org.freedesktop.DBus.Properties"</span><span class="symbol">,</span>
<span class="normal">                                         </span><span class="string">"PropertiesChanged"</span><span class="symbol">,</span>
<span class="normal">                                         </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(sa{sv}as)"</span><span class="symbol">,</span>
<span class="normal">                                                        interface_name</span><span class="symbol">,</span>
<span class="normal">                                                        builder</span><span class="symbol">,</span>
<span class="normal">                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">),</span>
<span class="normal">                                         </span><span class="symbol">&amp;</span><span class="normal">local_error</span><span class="symbol">);</span>
<span class="normal">          </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-no-error">g_assert_no_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">local_error</span><span class="symbol">);</span>
<span class="normal">        </span><span class="cbracket">}</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"ReadingAlwaysThrowsError"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="comment">/* do nothing - they can't read it after all! */</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"WritingAlwaysThrowsError"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#g-set-error">g_set_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">,</span>
<span class="normal">                   <a href="gio-GIOError.html#G-IO-ERROR:CAPS">G_IO_ERROR</a></span><span class="symbol">,</span>
<span class="normal">                   <a href="gio-GIOError.html#G-IO-ERROR-FAILED:CAPS">G_IO_ERROR_FAILED</a></span><span class="symbol">,</span>
<span class="normal">                   </span><span class="string">"Hello AGAIN %s. I thought I said writing this property "</span>
<span class="normal">                   </span><span class="string">"always results in an error. kthxbye"</span><span class="symbol">,</span>
<span class="normal">                   sender</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error </span><span class="symbol">==</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="cbracket">}</span>


<span class="comment">/* for now */</span>
<span class="keyword">static</span><span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">GDBusInterfaceVTable</span><span class="normal"> interface_vtable </span><span class="symbol">=</span>
<span class="cbracket">{</span>
<span class="normal">  handle_method_call</span><span class="symbol">,</span>
<span class="normal">  handle_get_property</span><span class="symbol">,</span>
<span class="normal">  handle_set_property</span>
<span class="cbracket">}</span><span class="symbol">;</span>

<span class="comment">/* ---------------------------------------------------------------------------------------------------- */</span>

<span class="keyword">static</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean">gboolean</a></span>
<span class="function">on_timeout_cb</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gpointer</span><span class="normal"> user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection </span><span class="symbol">=</span><span class="normal"> </span><span class="function">G_DBUS_CONNECTION</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">user_data</span><span class="symbol">);</span>
<span class="normal">  </span><span class="usertype">GVariantBuilder</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">builder</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GVariantBuilder</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">invalidated_builder</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error</span><span class="symbol">;</span>

<span class="normal">  swap_a_and_b </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">!</span><span class="normal">swap_a_and_b</span><span class="symbol">;</span>

<span class="normal">  error </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">  builder </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-builder-new">g_variant_builder_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#G-VARIANT-TYPE-ARRAY:CAPS">G_VARIANT_TYPE_ARRAY</a></span><span class="symbol">);</span>
<span class="normal">  invalidated_builder </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-builder-new">g_variant_builder_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#G-VARIANT-TYPE:CAPS">G_VARIANT_TYPE</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"as"</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">builder</span><span class="symbol">,</span>
<span class="normal">                         </span><span class="string">"{sv}"</span><span class="symbol">,</span>
<span class="normal">                         </span><span class="string">"Foo"</span><span class="symbol">,</span>
<span class="normal">                         </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">swap_a_and_b </span><span class="symbol">?</span><span class="normal"> </span><span class="string">"Tock"</span><span class="normal"> </span><span class="symbol">:</span><span class="normal"> </span><span class="string">"Tick"</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">builder</span><span class="symbol">,</span>
<span class="normal">                         </span><span class="string">"{sv}"</span><span class="symbol">,</span>
<span class="normal">                         </span><span class="string">"Bar"</span><span class="symbol">,</span>
<span class="normal">                         </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">swap_a_and_b </span><span class="symbol">?</span><span class="normal"> </span><span class="string">"Tick"</span><span class="normal"> </span><span class="symbol">:</span><span class="normal"> </span><span class="string">"Tock"</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="GDBusConnection.html#g-dbus-connection-emit-signal">g_dbus_connection_emit_signal</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                                 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                                 </span><span class="string">"/org/gtk/GDBus/TestObject"</span><span class="symbol">,</span>
<span class="normal">                                 </span><span class="string">"org.freedesktop.DBus.Properties"</span><span class="symbol">,</span>
<span class="normal">                                 </span><span class="string">"PropertiesChanged"</span><span class="symbol">,</span>
<span class="normal">                                 </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(sa{sv}as)"</span><span class="symbol">,</span>
<span class="normal">                                                </span><span class="string">"org.gtk.GDBus.TestInterface"</span><span class="symbol">,</span>
<span class="normal">                                                builder</span><span class="symbol">,</span>
<span class="normal">                                                invalidated_builder</span><span class="symbol">),</span>
<span class="normal">                                 </span><span class="symbol">&amp;</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-no-error">g_assert_no_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>


<span class="normal">  </span><span class="keyword">return</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS">TRUE</a></span><span class="symbol">;</span>
<span class="cbracket">}</span>

<span class="comment">/* ---------------------------------------------------------------------------------------------------- */</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">on_bus_acquired</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                 </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">,</span>
<span class="normal">                 </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">guint</span><span class="normal"> registration_id</span><span class="symbol">;</span>

<span class="normal">  registration_id </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDBusConnection.html#g-dbus-connection-register-object">g_dbus_connection_register_object</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                                                       </span><span class="string">"/org/gtk/GDBus/TestObject"</span><span class="symbol">,</span>
<span class="normal">                                                       introspection_data</span><span class="symbol">-&gt;</span><span class="normal">interfaces</span><span class="symbol">[</span><span class="number">0</span><span class="symbol">],</span>
<span class="normal">                                                       </span><span class="symbol">&amp;</span><span class="normal">interface_vtable</span><span class="symbol">,</span>
<span class="normal">                                                       <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal">  </span><span class="comment">/* user_data */</span>
<span class="normal">                                                       <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal">  </span><span class="comment">/* user_data_free_func */</span>
<span class="normal">                                                       <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span><span class="normal"> </span><span class="comment">/* GError** */</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">registration_id </span><span class="symbol">&gt;</span><span class="normal"> </span><span class="number">0</span><span class="symbol">);</span>

<span class="normal">  </span><span class="comment">/* swap value of properties Foo and Bar every two seconds */</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-timeout-add-seconds">g_timeout_add_seconds</a></span><span class="normal"> </span><span class="symbol">(</span><span class="number">2</span><span class="symbol">,</span>
<span class="normal">                         on_timeout_cb</span><span class="symbol">,</span>
<span class="normal">                         connection</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">on_name_acquired</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">on_name_lost</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">              </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">,</span>
<span class="normal">              </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="function">exit</span><span class="normal"> </span><span class="symbol">(</span><span class="number">1</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="type">int</span>
<span class="function">main</span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="normal"> argc</span><span class="symbol">,</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">argv</span><span class="symbol">[])</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">guint</span><span class="normal"> owner_id</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GMainLoop</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">loop</span><span class="symbol">;</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Type-Information.html#g-type-init">g_type_init</a></span><span class="normal"> </span><span class="symbol">();</span>

<span class="normal">  </span><span class="comment">/* We are lazy here - we don't want to manually provide</span>
<span class="comment">   * the introspection data structures - so we just build</span>
<span class="comment">   * them from XML.</span>
<span class="comment">   */</span>
<span class="normal">  introspection_data </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gio-D-Bus-Introspection-Data.html#g-dbus-node-info-new-for-xml">g_dbus_node_info_new_for_xml</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">introspection_xml</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">introspection_data </span><span class="symbol">!=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="normal">  owner_id </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gio-Owning-Bus-Names.html#g-bus-own-name">g_bus_own_name</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="GDBusConnection.html#G-BUS-TYPE-SESSION:CAPS">G_BUS_TYPE_SESSION</a></span><span class="symbol">,</span>
<span class="normal">                             </span><span class="string">"org.gtk.GDBus.TestServer"</span><span class="symbol">,</span>
<span class="normal">                             <a href="gio-Owning-Bus-Names.html#G-BUS-NAME-OWNER-FLAGS-NONE:CAPS">G_BUS_NAME_OWNER_FLAGS_NONE</a></span><span class="symbol">,</span>
<span class="normal">                             on_bus_acquired</span><span class="symbol">,</span>
<span class="normal">                             on_name_acquired</span><span class="symbol">,</span>
<span class="normal">                             on_name_lost</span><span class="symbol">,</span>
<span class="normal">                             <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                             <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="normal">  loop </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-loop-new">g_main_loop_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-loop-run">g_main_loop_run</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">loop</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="gio-Owning-Bus-Names.html#g-bus-unown-name">g_bus_unown_name</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">owner_id</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="gio-D-Bus-Introspection-Data.html#g-dbus-node-info-unref">g_dbus_node_info_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">introspection_data</span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<p><br class="example-break">
</p>
<p>
</p>
<div class="example">
<a name="gdbus-subtree-server"></a><p class="title"><b>Example 3. D-Bus subtree example</b></p>
<div class="example-contents">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;gio/gio.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;stdlib.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;string.h&gt;</span>

<span class="comment">/* ---------------------------------------------------------------------------------------------------- */</span>

<span class="keyword">static</span><span class="normal"> </span><span class="usertype">GDBusNodeInfo</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">introspection_data </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="keyword">static</span><span class="normal"> </span><span class="usertype">GDBusInterfaceInfo</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">manager_interface_info </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="keyword">static</span><span class="normal"> </span><span class="usertype">GDBusInterfaceInfo</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">block_interface_info </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="keyword">static</span><span class="normal"> </span><span class="usertype">GDBusInterfaceInfo</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">partition_interface_info </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>

<span class="comment">/* Introspection data for the service we are exporting */</span>
<span class="keyword">static</span><span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> introspection_xml</span><span class="symbol">[]</span><span class="normal"> </span><span class="symbol">=</span>
<span class="normal">  </span><span class="string">"&lt;node&gt;"</span>
<span class="normal">  </span><span class="string">"  &lt;interface name='org.gtk.GDBus.Example.Manager'&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;method name='Hello'&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;arg type='s' name='greeting' direction='in'/&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;arg type='s' name='response' direction='out'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;/method&gt;"</span>
<span class="normal">  </span><span class="string">"  &lt;/interface&gt;"</span>
<span class="normal">  </span><span class="string">"  &lt;interface name='org.gtk.GDBus.Example.Block'&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;method name='Hello'&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;arg type='s' name='greeting' direction='in'/&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;arg type='s' name='response' direction='out'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;/method&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='i' name='Major' access='read'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='i' name='Minor' access='read'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='s' name='Notes' access='readwrite'/&gt;"</span>
<span class="normal">  </span><span class="string">"  &lt;/interface&gt;"</span>
<span class="normal">  </span><span class="string">"  &lt;interface name='org.gtk.GDBus.Example.Partition'&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;method name='Hello'&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;arg type='s' name='greeting' direction='in'/&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;arg type='s' name='response' direction='out'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;/method&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='i' name='PartitionNumber' access='read'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='s' name='Notes' access='readwrite'/&gt;"</span>
<span class="normal">  </span><span class="string">"  &lt;/interface&gt;"</span>
<span class="normal">  </span><span class="string">"&lt;/node&gt;"</span><span class="symbol">;</span>

<span class="comment">/* ---------------------------------------------------------------------------------------------------- */</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">manager_method_call</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">       </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">interface_name</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">method_name</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">GVariant</span><span class="normal">              </span><span class="symbol">*</span><span class="normal">parameters</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">GDBusMethodInvocation</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">gpointer</span><span class="normal">               user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">greeting</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">response</span><span class="symbol">;</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpstr">g_assert_cmpstr</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">interface_name</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">==,</span><span class="normal"> </span><span class="string">"org.gtk.GDBus.Example.Manager"</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpstr">g_assert_cmpstr</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_name</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">==,</span><span class="normal"> </span><span class="string">"Hello"</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">parameters</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"(&amp;s)"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">greeting</span><span class="symbol">);</span>

<span class="normal">  response </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup-printf">g_strdup_printf</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Method %s.%s with user_data `%s' on object path %s called with arg '%s'"</span><span class="symbol">,</span>
<span class="normal">                              interface_name</span><span class="symbol">,</span>
<span class="normal">                              method_name</span><span class="symbol">,</span>
<span class="normal">                              </span><span class="symbol">(</span><span class="keyword">const</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar">gchar</a> </span><span class="symbol">*)</span><span class="normal"> user_data</span><span class="symbol">,</span>
<span class="normal">                              object_path</span><span class="symbol">,</span>
<span class="normal">                              greeting</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-return-value">g_dbus_method_invocation_return_value</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                                         </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(s)"</span><span class="symbol">,</span><span class="normal"> response</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">response</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">const</span><span class="normal"> </span><span class="usertype">GDBusInterfaceVTable</span><span class="normal"> manager_vtable </span><span class="symbol">=</span>
<span class="cbracket">{</span>
<span class="normal">  manager_method_call</span><span class="symbol">,</span>
<span class="normal">  <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal">                 </span><span class="comment">/* get_property */</span>
<span class="normal">  <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a>                  </span><span class="comment">/* set_property */</span>
<span class="cbracket">}</span><span class="symbol">;</span>

<span class="comment">/* ---------------------------------------------------------------------------------------------------- */</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">block_method_call</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">       </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                   </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                   </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                   </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">interface_name</span><span class="symbol">,</span>
<span class="normal">                   </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">method_name</span><span class="symbol">,</span>
<span class="normal">                   </span><span class="usertype">GVariant</span><span class="normal">              </span><span class="symbol">*</span><span class="normal">parameters</span><span class="symbol">,</span>
<span class="normal">                   </span><span class="usertype">GDBusMethodInvocation</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                   </span><span class="usertype">gpointer</span><span class="normal">               user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpstr">g_assert_cmpstr</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">interface_name</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">==,</span><span class="normal"> </span><span class="string">"org.gtk.GDBus.Example.Block"</span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Hello"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">greeting</span><span class="symbol">;</span>
<span class="normal">      </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">response</span><span class="symbol">;</span>

<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">parameters</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"(&amp;s)"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">greeting</span><span class="symbol">);</span>

<span class="normal">      response </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup-printf">g_strdup_printf</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Method %s.%s with user_data `%s' on object path %s called with arg '%s'"</span><span class="symbol">,</span>
<span class="normal">                                  interface_name</span><span class="symbol">,</span>
<span class="normal">                                  method_name</span><span class="symbol">,</span>
<span class="normal">                                  </span><span class="symbol">(</span><span class="keyword">const</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar">gchar</a> </span><span class="symbol">*)</span><span class="normal"> user_data</span><span class="symbol">,</span>
<span class="normal">                                  object_path</span><span class="symbol">,</span>
<span class="normal">                                  greeting</span><span class="symbol">);</span>
<span class="normal">      </span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-return-value">g_dbus_method_invocation_return_value</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                                             </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(s)"</span><span class="symbol">,</span><span class="normal"> response</span><span class="symbol">));</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">response</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"DoStuff"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-return-dbus-error">g_dbus_method_invocation_return_dbus_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                                                  </span><span class="string">"org.gtk.GDBus.TestSubtree.Error.Failed"</span><span class="symbol">,</span>
<span class="normal">                                                  </span><span class="string">"This method intentionally always fails"</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-not-reached">g_assert_not_reached</a></span><span class="normal"> </span><span class="symbol">();</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant">GVariant</a> </span><span class="symbol">*</span>
<span class="function">block_get_property</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">  </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">interface_name</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">property_name</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="usertype">GError</span><span class="normal">          </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="usertype">gpointer</span><span class="normal">          user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">ret</span><span class="symbol">;</span>
<span class="normal">  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">node</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">gint</span><span class="normal"> major</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">gint</span><span class="normal"> minor</span><span class="symbol">;</span>

<span class="normal">  node </span><span class="symbol">=</span><span class="normal"> </span><span class="function">strrchr</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">object_path</span><span class="symbol">,</span><span class="normal"> </span><span class="string">'/'</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">+</span><span class="normal"> </span><span class="number">1</span><span class="symbol">;</span>
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-str-has-prefix">g_str_has_prefix</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">node</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"sda"</span><span class="symbol">))</span>
<span class="normal">    major </span><span class="symbol">=</span><span class="normal"> </span><span class="number">8</span><span class="symbol">;</span>
<span class="normal">  </span><span class="keyword">else</span>
<span class="normal">    major </span><span class="symbol">=</span><span class="normal"> </span><span class="number">9</span><span class="symbol">;</span>
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function">strlen</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">node</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">4</span><span class="symbol">)</span>
<span class="normal">    minor </span><span class="symbol">=</span><span class="normal"> node</span><span class="symbol">[</span><span class="number">3</span><span class="symbol">]</span><span class="normal"> </span><span class="symbol">-</span><span class="normal"> </span><span class="string">'0'</span><span class="symbol">;</span>
<span class="normal">  </span><span class="keyword">else</span>
<span class="normal">    minor </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>

<span class="normal">  ret </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Major"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      ret </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-int32">g_variant_new_int32</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">major</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Minor"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      ret </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-int32">g_variant_new_int32</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">minor</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Notes"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#g-set-error">g_set_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">,</span>
<span class="normal">                   <a href="gio-GIOError.html#G-IO-ERROR:CAPS">G_IO_ERROR</a></span><span class="symbol">,</span>
<span class="normal">                   <a href="gio-GIOError.html#G-IO-ERROR-FAILED:CAPS">G_IO_ERROR_FAILED</a></span><span class="symbol">,</span>
<span class="normal">                   </span><span class="string">"Hello %s. I thought I said reading this property "</span>
<span class="normal">                   </span><span class="string">"always results in an error. kthxbye"</span><span class="symbol">,</span>
<span class="normal">                   sender</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-not-reached">g_assert_not_reached</a></span><span class="normal"> </span><span class="symbol">();</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> ret</span><span class="symbol">;</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean">gboolean</a></span>
<span class="function">block_set_property</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">  </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">interface_name</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">property_name</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="usertype">GVariant</span><span class="normal">         </span><span class="symbol">*</span><span class="normal">value</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="usertype">GError</span><span class="normal">          </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="usertype">gpointer</span><span class="normal">          user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="comment">/* </span><span class="todo">TODO</span><span class="comment"> */</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-not-reached">g_assert_not_reached</a></span><span class="normal"> </span><span class="symbol">();</span>
<span class="cbracket">}</span>

<span class="keyword">const</span><span class="normal"> </span><span class="usertype">GDBusInterfaceVTable</span><span class="normal"> block_vtable </span><span class="symbol">=</span>
<span class="cbracket">{</span>
<span class="normal">  block_method_call</span><span class="symbol">,</span>
<span class="normal">  block_get_property</span><span class="symbol">,</span>
<span class="normal">  block_set_property</span><span class="symbol">,</span>
<span class="cbracket">}</span><span class="symbol">;</span>

<span class="comment">/* ---------------------------------------------------------------------------------------------------- */</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">partition_method_call</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">       </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                       </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                       </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                       </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">interface_name</span><span class="symbol">,</span>
<span class="normal">                       </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">method_name</span><span class="symbol">,</span>
<span class="normal">                       </span><span class="usertype">GVariant</span><span class="normal">              </span><span class="symbol">*</span><span class="normal">parameters</span><span class="symbol">,</span>
<span class="normal">                       </span><span class="usertype">GDBusMethodInvocation</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                       </span><span class="usertype">gpointer</span><span class="normal">               user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">greeting</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">response</span><span class="symbol">;</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpstr">g_assert_cmpstr</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">interface_name</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">==,</span><span class="normal"> </span><span class="string">"org.gtk.GDBus.Example.Partition"</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-cmpstr">g_assert_cmpstr</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_name</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">==,</span><span class="normal"> </span><span class="string">"Hello"</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">parameters</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"(&amp;s)"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">greeting</span><span class="symbol">);</span>

<span class="normal">  response </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup-printf">g_strdup_printf</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Method %s.%s with user_data `%s' on object path %s called with arg '%s'"</span><span class="symbol">,</span>
<span class="normal">                              interface_name</span><span class="symbol">,</span>
<span class="normal">                              method_name</span><span class="symbol">,</span>
<span class="normal">                              </span><span class="symbol">(</span><span class="keyword">const</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar">gchar</a> </span><span class="symbol">*)</span><span class="normal"> user_data</span><span class="symbol">,</span>
<span class="normal">                              object_path</span><span class="symbol">,</span>
<span class="normal">                              greeting</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-return-value">g_dbus_method_invocation_return_value</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                                         </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(s)"</span><span class="symbol">,</span><span class="normal"> response</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">response</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">const</span><span class="normal"> </span><span class="usertype">GDBusInterfaceVTable</span><span class="normal"> partition_vtable </span><span class="symbol">=</span>
<span class="cbracket">{</span>
<span class="normal">  partition_method_call</span><span class="symbol">,</span>
<span class="normal">  </span><span class="comment">//partition_get_property,</span>
<span class="normal">  </span><span class="comment">//partition_set_property</span>
<span class="cbracket">}</span><span class="symbol">;</span>

<span class="comment">/* ---------------------------------------------------------------------------------------------------- */</span>

<span class="keyword">static</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar">gchar</a> </span><span class="symbol">**</span>
<span class="function">subtree_enumerate</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">       </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                   </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                   </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                   </span><span class="usertype">gpointer</span><span class="normal">               user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">**</span><span class="normal">nodes</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GPtrArray</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">p</span><span class="symbol">;</span>

<span class="normal">  p </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-new">g_ptr_array_new</a></span><span class="normal"> </span><span class="symbol">();</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"sda"</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"sda1"</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"sda2"</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"sda3"</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"sdb"</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"sdb1"</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"sdc"</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup">g_strdup</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"sdc1"</span><span class="symbol">));</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">  nodes </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar">gchar</a> </span><span class="symbol">**)</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-free">g_ptr_array_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> nodes</span><span class="symbol">;</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> <a href="gio-D-Bus-Introspection-Data.html#GDBusInterfaceInfo">GDBusInterfaceInfo</a> </span><span class="symbol">**</span>
<span class="function">subtree_introspect</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">       </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">node</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="usertype">gpointer</span><span class="normal">               user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GPtrArray</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">p</span><span class="symbol">;</span>

<span class="normal">  p </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-new">g_ptr_array_new</a></span><span class="normal"> </span><span class="symbol">();</span>
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">node </span><span class="symbol">==</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="gio-D-Bus-Introspection-Data.html#g-dbus-interface-info-ref">g_dbus_interface_info_ref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">manager_interface_info</span><span class="symbol">));</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="gio-D-Bus-Introspection-Data.html#g-dbus-interface-info-ref">g_dbus_interface_info_ref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">block_interface_info</span><span class="symbol">));</span>
<span class="normal">      </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function">strlen</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">node</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">4</span><span class="symbol">)</span>
<span class="normal">        </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span>
<span class="normal">                         </span><span class="function"><a href="gio-D-Bus-Introspection-Data.html#g-dbus-interface-info-ref">g_dbus_interface_info_ref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">partition_interface_info</span><span class="symbol">));</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-add">g_ptr_array_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="gio-D-Bus-Introspection-Data.html#GDBusInterfaceInfo">GDBusInterfaceInfo</a> </span><span class="symbol">**)</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Pointer-Arrays.html#g-ptr-array-free">g_ptr_array_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">p</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="keyword">const</span><span class="normal"> <a href="GDBusConnection.html#GDBusInterfaceVTable">GDBusInterfaceVTable</a> </span><span class="symbol">*</span>
<span class="function">subtree_dispatch</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">             </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">                 </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">                 </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">                 </span><span class="symbol">*</span><span class="normal">interface_name</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">                 </span><span class="symbol">*</span><span class="normal">node</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="usertype">gpointer</span><span class="normal">                    </span><span class="symbol">*</span><span class="normal">out_user_data</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="usertype">gpointer</span><span class="normal">                     user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">GDBusInterfaceVTable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">vtable_to_return</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">gpointer</span><span class="normal"> user_data_to_return</span><span class="symbol">;</span>

<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">interface_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"org.gtk.GDBus.Example.Manager"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      user_data_to_return </span><span class="symbol">=</span><span class="normal"> </span><span class="string">"The Root"</span><span class="symbol">;</span>
<span class="normal">      vtable_to_return </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">manager_vtable</span><span class="symbol">;</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function">strlen</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">node</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">4</span><span class="symbol">)</span>
<span class="normal">        user_data_to_return </span><span class="symbol">=</span><span class="normal"> </span><span class="string">"A partition"</span><span class="symbol">;</span>
<span class="normal">      </span><span class="keyword">else</span>
<span class="normal">        user_data_to_return </span><span class="symbol">=</span><span class="normal"> </span><span class="string">"A block device"</span><span class="symbol">;</span>

<span class="normal">      </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">interface_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"org.gtk.GDBus.Example.Block"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">        vtable_to_return </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">block_vtable</span><span class="symbol">;</span>
<span class="normal">      </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">interface_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"org.gtk.GDBus.Example.Partition"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">        vtable_to_return </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">partition_vtable</span><span class="symbol">;</span>
<span class="normal">      </span><span class="keyword">else</span>
<span class="normal">        </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert-not-reached">g_assert_not_reached</a></span><span class="normal"> </span><span class="symbol">();</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">  </span><span class="symbol">*</span><span class="normal">out_user_data </span><span class="symbol">=</span><span class="normal"> user_data_to_return</span><span class="symbol">;</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> vtable_to_return</span><span class="symbol">;</span>
<span class="cbracket">}</span>

<span class="keyword">const</span><span class="normal"> </span><span class="usertype">GDBusSubtreeVTable</span><span class="normal"> subtree_vtable </span><span class="symbol">=</span>
<span class="cbracket">{</span>
<span class="normal">  subtree_enumerate</span><span class="symbol">,</span>
<span class="normal">  subtree_introspect</span><span class="symbol">,</span>
<span class="normal">  subtree_dispatch</span>
<span class="cbracket">}</span><span class="symbol">;</span>

<span class="comment">/* ---------------------------------------------------------------------------------------------------- */</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">on_bus_acquired</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                 </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">,</span>
<span class="normal">                 </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">guint</span><span class="normal"> registration_id</span><span class="symbol">;</span>

<span class="normal">  registration_id </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDBusConnection.html#g-dbus-connection-register-subtree">g_dbus_connection_register_subtree</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                                                        </span><span class="string">"/org/gtk/GDBus/TestSubtree/Devices"</span><span class="symbol">,</span>
<span class="normal">                                                        </span><span class="symbol">&amp;</span><span class="normal">subtree_vtable</span><span class="symbol">,</span>
<span class="normal">                                                        <a href="GDBusConnection.html#G-DBUS-SUBTREE-FLAGS-NONE:CAPS">G_DBUS_SUBTREE_FLAGS_NONE</a></span><span class="symbol">,</span>
<span class="normal">                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal">  </span><span class="comment">/* user_data */</span>
<span class="normal">                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal">  </span><span class="comment">/* user_data_free_func */</span>
<span class="normal">                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span><span class="normal"> </span><span class="comment">/* GError** */</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">registration_id </span><span class="symbol">&gt;</span><span class="normal"> </span><span class="number">0</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">on_name_acquired</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">on_name_lost</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">              </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">,</span>
<span class="normal">              </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="function">exit</span><span class="normal"> </span><span class="symbol">(</span><span class="number">1</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="type">int</span>
<span class="function">main</span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="normal"> argc</span><span class="symbol">,</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">argv</span><span class="symbol">[])</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">guint</span><span class="normal"> owner_id</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GMainLoop</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">loop</span><span class="symbol">;</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Type-Information.html#g-type-init">g_type_init</a></span><span class="normal"> </span><span class="symbol">();</span>

<span class="normal">  </span><span class="comment">/* We are lazy here - we don't want to manually provide</span>
<span class="comment">   * the introspection data structures - so we just build</span>
<span class="comment">   * them from XML.</span>
<span class="comment">   */</span>
<span class="normal">  introspection_data </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gio-D-Bus-Introspection-Data.html#g-dbus-node-info-new-for-xml">g_dbus_node_info_new_for_xml</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">introspection_xml</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">introspection_data </span><span class="symbol">!=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="normal">  manager_interface_info </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gio-D-Bus-Introspection-Data.html#g-dbus-node-info-lookup-interface">g_dbus_node_info_lookup_interface</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">introspection_data</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"org.gtk.GDBus.Example.Manager"</span><span class="symbol">);</span>
<span class="normal">  block_interface_info </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gio-D-Bus-Introspection-Data.html#g-dbus-node-info-lookup-interface">g_dbus_node_info_lookup_interface</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">introspection_data</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"org.gtk.GDBus.Example.Block"</span><span class="symbol">);</span>
<span class="normal">  partition_interface_info </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gio-D-Bus-Introspection-Data.html#g-dbus-node-info-lookup-interface">g_dbus_node_info_lookup_interface</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">introspection_data</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"org.gtk.GDBus.Example.Partition"</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">manager_interface_info </span><span class="symbol">!=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">block_interface_info </span><span class="symbol">!=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">partition_interface_info </span><span class="symbol">!=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="normal">  owner_id </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gio-Owning-Bus-Names.html#g-bus-own-name">g_bus_own_name</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="GDBusConnection.html#G-BUS-TYPE-SESSION:CAPS">G_BUS_TYPE_SESSION</a></span><span class="symbol">,</span>
<span class="normal">                             </span><span class="string">"org.gtk.GDBus.TestSubtree"</span><span class="symbol">,</span>
<span class="normal">                             <a href="gio-Owning-Bus-Names.html#G-BUS-NAME-OWNER-FLAGS-NONE:CAPS">G_BUS_NAME_OWNER_FLAGS_NONE</a></span><span class="symbol">,</span>
<span class="normal">                             on_bus_acquired</span><span class="symbol">,</span>
<span class="normal">                             on_name_acquired</span><span class="symbol">,</span>
<span class="normal">                             on_name_lost</span><span class="symbol">,</span>
<span class="normal">                             <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                             <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="normal">  loop </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-loop-new">g_main_loop_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-loop-run">g_main_loop_run</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">loop</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="gio-Owning-Bus-Names.html#g-bus-unown-name">g_bus_unown_name</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">owner_id</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="gio-D-Bus-Introspection-Data.html#g-dbus-node-info-unref">g_dbus_node_info_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">introspection_data</span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<p><br class="example-break">
</p>
<p>
</p>
<div class="example">
<a name="gdbus-unix-fd-client"></a><p class="title"><b>Example 4. D-Bus UNIX File Descriptor example</b></p>
<div class="example-contents">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;string.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;stdlib.h&gt;</span>

<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;sys/types.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;unistd.h&gt;</span>

<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;time.h&gt;</span>

<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;gio/gio.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;gio/gunixfdlist.h&gt;</span>

<span class="comment">/* see gdbus-example-server.c for the server implementation */</span>
<span class="keyword">static</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint">gint</a></span>
<span class="function">get_server_stdout</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">  </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                   </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">name_owner</span><span class="symbol">,</span>
<span class="normal">                   </span><span class="usertype">GError</span><span class="normal">          </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GDBusMessage</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">method_call_message</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GDBusMessage</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">method_reply_message</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GUnixFDList</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">fd_list</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">gint</span><span class="normal"> fd</span><span class="symbol">;</span>

<span class="normal">  fd </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">-</span><span class="number">1</span><span class="symbol">;</span>
<span class="normal">  method_call_message </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">  method_reply_message </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>

<span class="normal">  method_call_message </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDBusMessage.html#g-dbus-message-new-method-call">g_dbus_message_new_method_call</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">name_owner</span><span class="symbol">,</span>
<span class="normal">                                                        </span><span class="string">"/org/gtk/GDBus/TestObject"</span><span class="symbol">,</span>
<span class="normal">                                                        </span><span class="string">"org.gtk.GDBus.TestInterface"</span><span class="symbol">,</span>
<span class="normal">                                                        </span><span class="string">"GimmeStdout"</span><span class="symbol">);</span>
<span class="normal">  method_reply_message </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDBusConnection.html#g-dbus-connection-send-message-with-reply-sync">g_dbus_connection_send_message_with_reply_sync</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                                                                         method_call_message</span><span class="symbol">,</span>
<span class="normal">                                                                         <a href="GDBusConnection.html#G-DBUS-SEND-MESSAGE-FLAGS-NONE:CAPS">G_DBUS_SEND_MESSAGE_FLAGS_NONE</a></span><span class="symbol">,</span>
<span class="normal">                                                                         </span><span class="symbol">-</span><span class="number">1</span><span class="symbol">,</span>
<span class="normal">                                                                         <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="comment">/* out_serial */</span>
<span class="normal">                                                                         <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="comment">/* cancellable */</span>
<span class="normal">                                                                         error</span><span class="symbol">);</span>
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_reply_message </span><span class="symbol">==</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span>
<span class="normal">      </span><span class="keyword">goto</span><span class="normal"> out</span><span class="symbol">;</span>

<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GDBusMessage.html#g-dbus-message-get-message-type">g_dbus_message_get_message_type</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_reply_message</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> <a href="GDBusMessage.html#G-DBUS-MESSAGE-TYPE-ERROR:CAPS">G_DBUS_MESSAGE_TYPE_ERROR</a></span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="GDBusMessage.html#g-dbus-message-to-gerror">g_dbus_message_to_gerror</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_reply_message</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">);</span>
<span class="normal">      </span><span class="keyword">goto</span><span class="normal"> out</span><span class="symbol">;</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">  fd_list </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDBusMessage.html#g-dbus-message-get-unix-fd-list">g_dbus_message_get_unix_fd_list</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_reply_message</span><span class="symbol">);</span>
<span class="normal">  fd </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GUnixFDList.html#g-unix-fd-list-get">g_unix_fd_list_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">fd_list</span><span class="symbol">,</span><span class="normal"> </span><span class="number">0</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">);</span>

<span class="label"> out:</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_call_message</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_reply_message</span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> fd</span><span class="symbol">;</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">on_name_appeared</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">name_owner</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">gint</span><span class="normal"> fd</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error</span><span class="symbol">;</span>

<span class="normal">  error </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">  fd </span><span class="symbol">=</span><span class="normal"> </span><span class="function">get_server_stdout</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">,</span><span class="normal"> name_owner</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">fd </span><span class="symbol">==</span><span class="normal"> </span><span class="symbol">-</span><span class="number">1</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-printerr">g_printerr</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Error invoking GimmeStdout(): %s</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span>
<span class="normal">                  error</span><span class="symbol">-&gt;</span><span class="normal">message</span><span class="symbol">);</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#g-error-free">g_error_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal">      </span><span class="function">exit</span><span class="normal"> </span><span class="symbol">(</span><span class="number">1</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="usertype">gchar</span><span class="normal"> now_buf</span><span class="symbol">[</span><span class="number">256</span><span class="symbol">];</span>
<span class="normal">      </span><span class="usertype">time_t</span><span class="normal"> now</span><span class="symbol">;</span>
<span class="normal">      </span><span class="usertype">gssize</span><span class="normal"> len</span><span class="symbol">;</span>
<span class="normal">      </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">str</span><span class="symbol">;</span>

<span class="normal">      now </span><span class="symbol">=</span><span class="normal"> </span><span class="function">time</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">      </span><span class="function">strftime</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">now_buf</span><span class="symbol">,</span>
<span class="normal">                </span><span class="keyword">sizeof</span><span class="normal"> now_buf</span><span class="symbol">,</span>
<span class="normal">                </span><span class="string">"%c"</span><span class="symbol">,</span>
<span class="normal">                </span><span class="function">localtime</span><span class="normal"> </span><span class="symbol">(&amp;</span><span class="normal">now</span><span class="symbol">));</span>

<span class="normal">      str </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strdup-printf">g_strdup_printf</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"On %s, gdbus-example-unix-fd-client with pid %d was here!</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span>
<span class="normal">                             now_buf</span><span class="symbol">,</span>
<span class="normal">                             </span><span class="symbol">(</span><span class="normal"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint">gint</a></span><span class="symbol">)</span><span class="normal"> </span><span class="function">getpid</span><span class="normal"> </span><span class="symbol">());</span>
<span class="normal">      len </span><span class="symbol">=</span><span class="normal"> </span><span class="function">strlen</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">str</span><span class="symbol">);</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-warn-if-fail">g_warn_if_fail</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">write</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">fd</span><span class="symbol">,</span><span class="normal"> str</span><span class="symbol">,</span><span class="normal"> len</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> len</span><span class="symbol">);</span>
<span class="normal">      </span><span class="function">close</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">fd</span><span class="symbol">);</span>

<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Wrote the following on server's stdout:</span><span class="specialchar">\n</span><span class="string">%s"</span><span class="symbol">,</span><span class="normal"> str</span><span class="symbol">);</span>

<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">str</span><span class="symbol">);</span>
<span class="normal">      </span><span class="function">exit</span><span class="normal"> </span><span class="symbol">(</span><span class="number">0</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">on_name_vanished</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-printerr">g_printerr</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Failed to get name owner for %s</span><span class="specialchar">\n</span><span class="string">"</span>
<span class="normal">              </span><span class="string">"Is ./gdbus-example-server running?</span><span class="specialchar">\n</span><span class="string">"</span><span class="symbol">,</span>
<span class="normal">              name</span><span class="symbol">);</span>
<span class="normal">  </span><span class="function">exit</span><span class="normal"> </span><span class="symbol">(</span><span class="number">1</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="type">int</span>
<span class="function">main</span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="normal"> argc</span><span class="symbol">,</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">argv</span><span class="symbol">[])</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">guint</span><span class="normal"> watcher_id</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GMainLoop</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">loop</span><span class="symbol">;</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Type-Information.html#g-type-init">g_type_init</a></span><span class="normal"> </span><span class="symbol">();</span>

<span class="normal">  watcher_id </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gio-Watching-Bus-Names.html#g-bus-watch-name">g_bus_watch_name</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="GDBusConnection.html#G-BUS-TYPE-SESSION:CAPS">G_BUS_TYPE_SESSION</a></span><span class="symbol">,</span>
<span class="normal">                                 </span><span class="string">"org.gtk.GDBus.TestServer"</span><span class="symbol">,</span>
<span class="normal">                                 <a href="gio-Watching-Bus-Names.html#G-BUS-NAME-WATCHER-FLAGS-NONE:CAPS">G_BUS_NAME_WATCHER_FLAGS_NONE</a></span><span class="symbol">,</span>
<span class="normal">                                 on_name_appeared</span><span class="symbol">,</span>
<span class="normal">                                 on_name_vanished</span><span class="symbol">,</span>
<span class="normal">                                 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                                 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="normal">  loop </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-loop-new">g_main_loop_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-loop-run">g_main_loop_run</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">loop</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="gio-Watching-Bus-Names.html#g-bus-unwatch-name">g_bus_unwatch_name</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">watcher_id</span><span class="symbol">);</span>
<span class="normal">  </span><span class="keyword">return</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<p><br class="example-break">
</p>
<p>
</p>
<div class="example">
<a name="gdbus-export"></a><p class="title"><b>Example 5. Exporting a GObject</b></p>
<div class="example-contents">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;gio/gio.h&gt;</span>
<span class="preproc">#include</span><span class="normal"> </span><span class="string">&lt;stdlib.h&gt;</span>

<span class="comment">/* ---------------------------------------------------------------------------------------------------- */</span>

<span class="comment">/* The object we want to export */</span>
<span class="keyword">typedef</span><span class="normal"> </span><span class="keyword">struct</span><span class="normal"> </span><span class="classname">_MyObjectClass</span><span class="normal"> MyObjectClass</span><span class="symbol">;</span>
<span class="keyword">typedef</span><span class="normal"> </span><span class="keyword">struct</span><span class="normal"> </span><span class="classname">_MyObject</span><span class="normal"> MyObject</span><span class="symbol">;</span>

<span class="keyword">struct</span><span class="normal"> </span><span class="classname">_MyObjectClass</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GObjectClass</span><span class="normal"> parent_class</span><span class="symbol">;</span>
<span class="cbracket">}</span><span class="symbol">;</span>

<span class="keyword">struct</span><span class="normal"> </span><span class="classname">_MyObject</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GObject</span><span class="normal"> parent_instance</span><span class="symbol">;</span>

<span class="normal">  </span><span class="usertype">gint</span><span class="normal"> count</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">;</span>
<span class="cbracket">}</span><span class="symbol">;</span>

<span class="keyword">enum</span>
<span class="cbracket">{</span>
<span class="normal">  PROP_0</span><span class="symbol">,</span>
<span class="normal">  PROP_COUNT</span><span class="symbol">,</span>
<span class="normal">  PROP_NAME</span>
<span class="cbracket">}</span><span class="symbol">;</span>

<span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Type-Information.html#G-DEFINE-TYPE:CAPS">G_DEFINE_TYPE</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">MyObject</span><span class="symbol">,</span><span class="normal"> my_object</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Type-Information.html#G-TYPE-OBJECT:CAPS">G_TYPE_OBJECT</a></span><span class="symbol">);</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">my_object_finalize</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">object</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">MyObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">myobj </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">MyObject</span><span class="symbol">*)</span><span class="normal">object</span><span class="symbol">;</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">myobj</span><span class="symbol">-&gt;</span><span class="normal">name</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#G-OBJECT-CLASS:CAPS">G_OBJECT_CLASS</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">my_object_parent_class</span><span class="symbol">)-&gt;</span><span class="function">finalize</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">object</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">my_object_init</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">MyObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">object</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  object</span><span class="symbol">-&gt;</span><span class="normal">count </span><span class="symbol">=</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
<span class="normal">  object</span><span class="symbol">-&gt;</span><span class="normal">name </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">my_object_get_property</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GObject</span><span class="normal">    </span><span class="symbol">*</span><span class="normal">object</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="usertype">guint</span><span class="normal">       prop_id</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="usertype">GValue</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">value</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="usertype">GParamSpec</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">pspec</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">MyObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">myobj </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">MyObject</span><span class="symbol">*)</span><span class="normal">object</span><span class="symbol">;</span>

<span class="normal">  </span><span class="keyword">switch</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">prop_id</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">    </span><span class="keyword">case</span><span class="normal"> PROP_COUNT</span><span class="symbol">:</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Standard-Parameter-and-Value-Types.html#g-value-set-int">g_value_set_int</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value</span><span class="symbol">,</span><span class="normal"> myobj</span><span class="symbol">-&gt;</span><span class="normal">count</span><span class="symbol">);</span>
<span class="normal">      </span><span class="keyword">break</span><span class="symbol">;</span>

<span class="normal">    </span><span class="keyword">case</span><span class="normal"> PROP_NAME</span><span class="symbol">:</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Standard-Parameter-and-Value-Types.html#g-value-set-string">g_value_set_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value</span><span class="symbol">,</span><span class="normal"> myobj</span><span class="symbol">-&gt;</span><span class="normal">name</span><span class="symbol">);</span>
<span class="normal">      </span><span class="keyword">break</span><span class="symbol">;</span>

<span class="label">    default:</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#G-OBJECT-WARN-INVALID-PROPERTY-ID:CAPS">G_OBJECT_WARN_INVALID_PROPERTY_ID</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">object</span><span class="symbol">,</span><span class="normal"> prop_id</span><span class="symbol">,</span><span class="normal"> pspec</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">my_object_set_property</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GObject</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">object</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="usertype">guint</span><span class="normal">         prop_id</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">GValue</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">value</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="usertype">GParamSpec</span><span class="normal">   </span><span class="symbol">*</span><span class="normal">pspec</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">MyObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">myobj </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">MyObject</span><span class="symbol">*)</span><span class="normal">object</span><span class="symbol">;</span>

<span class="normal">  </span><span class="keyword">switch</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">prop_id</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">    </span><span class="keyword">case</span><span class="normal"> PROP_COUNT</span><span class="symbol">:</span>
<span class="normal">      myobj</span><span class="symbol">-&gt;</span><span class="normal">count </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Standard-Parameter-and-Value-Types.html#g-value-get-int">g_value_get_int</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value</span><span class="symbol">);</span>
<span class="normal">      </span><span class="keyword">break</span><span class="symbol">;</span>

<span class="normal">    </span><span class="keyword">case</span><span class="normal"> PROP_NAME</span><span class="symbol">:</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free">g_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">myobj</span><span class="symbol">-&gt;</span><span class="normal">name</span><span class="symbol">);</span>
<span class="normal">      myobj</span><span class="symbol">-&gt;</span><span class="normal">name </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Standard-Parameter-and-Value-Types.html#g-value-dup-string">g_value_dup_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value</span><span class="symbol">);</span>
<span class="normal">      </span><span class="keyword">break</span><span class="symbol">;</span>

<span class="label">    default:</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#G-OBJECT-WARN-INVALID-PROPERTY-ID:CAPS">G_OBJECT_WARN_INVALID_PROPERTY_ID</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">object</span><span class="symbol">,</span><span class="normal"> prop_id</span><span class="symbol">,</span><span class="normal"> pspec</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">my_object_class_init</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">MyObjectClass</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">class</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GObjectClass</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">gobject_class </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#G-OBJECT-CLASS:CAPS">G_OBJECT_CLASS</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">class</span><span class="symbol">);</span>

<span class="normal">  gobject_class</span><span class="symbol">-&gt;</span><span class="normal">finalize </span><span class="symbol">=</span><span class="normal"> my_object_finalize</span><span class="symbol">;</span>
<span class="normal">  gobject_class</span><span class="symbol">-&gt;</span><span class="normal">set_property </span><span class="symbol">=</span><span class="normal"> my_object_set_property</span><span class="symbol">;</span>
<span class="normal">  gobject_class</span><span class="symbol">-&gt;</span><span class="normal">get_property </span><span class="symbol">=</span><span class="normal"> my_object_get_property</span><span class="symbol">;</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-class-install-property">g_object_class_install_property</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">gobject_class</span><span class="symbol">,</span>
<span class="normal">                                   PROP_COUNT</span><span class="symbol">,</span>
<span class="normal">                                   </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Standard-Parameter-and-Value-Types.html#g-param-spec-int">g_param_spec_int</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"count"</span><span class="symbol">,</span>
<span class="normal">                                                     </span><span class="string">"Count"</span><span class="symbol">,</span>
<span class="normal">                                                     </span><span class="string">"Count"</span><span class="symbol">,</span>
<span class="normal">                                                     </span><span class="number">0</span><span class="symbol">,</span><span class="normal"> </span><span class="number">99999</span><span class="symbol">,</span><span class="normal"> </span><span class="number">0</span><span class="symbol">,</span>
<span class="normal">                                                     <a href="http://library.gnome.org/devel/gobject/unstable/gobject-GParamSpec.html#G-PARAM-READWRITE:CAPS">G_PARAM_READWRITE</a></span><span class="symbol">));</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-class-install-property">g_object_class_install_property</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">gobject_class</span><span class="symbol">,</span>
<span class="normal">                                   PROP_NAME</span><span class="symbol">,</span>
<span class="normal">                                   </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Standard-Parameter-and-Value-Types.html#g-param-spec-string">g_param_spec_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"name"</span><span class="symbol">,</span>
<span class="normal">                                                        </span><span class="string">"Name"</span><span class="symbol">,</span>
<span class="normal">                                                        </span><span class="string">"Name"</span><span class="symbol">,</span>
<span class="normal">                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                                                        <a href="http://library.gnome.org/devel/gobject/unstable/gobject-GParamSpec.html#G-PARAM-READWRITE:CAPS">G_PARAM_READWRITE</a></span><span class="symbol">));</span>
<span class="cbracket">}</span>

<span class="comment">/* A method that we want to export */</span>
<span class="type">void</span>
<span class="function">my_object_change_count</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">MyObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">myobj</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="usertype">gint</span><span class="normal">      change</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  myobj</span><span class="symbol">-&gt;</span><span class="normal">count </span><span class="symbol">=</span><span class="normal"> </span><span class="number">2</span><span class="normal"> </span><span class="symbol">*</span><span class="normal"> myobj</span><span class="symbol">-&gt;</span><span class="normal">count </span><span class="symbol">+</span><span class="normal"> change</span><span class="symbol">;</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-notify">g_object_notify</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#G-OBJECT:CAPS">G_OBJECT</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">myobj</span><span class="symbol">),</span><span class="normal"> </span><span class="string">"count"</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="comment">/* ---------------------------------------------------------------------------------------------------- */</span>

<span class="keyword">static</span><span class="normal"> </span><span class="usertype">GDBusNodeInfo</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">introspection_data </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>

<span class="comment">/* Introspection data for the service we are exporting */</span>
<span class="keyword">static</span><span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> introspection_xml</span><span class="symbol">[]</span><span class="normal"> </span><span class="symbol">=</span>
<span class="normal">  </span><span class="string">"&lt;node&gt;"</span>
<span class="normal">  </span><span class="string">"  &lt;interface name='org.myorg.MyObject'&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;method name='ChangeCount'&gt;"</span>
<span class="normal">  </span><span class="string">"      &lt;arg type='i' name='change' direction='in'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;/method&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='i' name='Count' access='read'/&gt;"</span>
<span class="normal">  </span><span class="string">"    &lt;property type='s' name='Name' access='readwrite'/&gt;"</span>
<span class="normal">  </span><span class="string">"  &lt;/interface&gt;"</span>
<span class="normal">  </span><span class="string">"&lt;/node&gt;"</span><span class="symbol">;</span>


<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">handle_method_call</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">       </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">interface_name</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">           </span><span class="symbol">*</span><span class="normal">method_name</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="usertype">GVariant</span><span class="normal">              </span><span class="symbol">*</span><span class="normal">parameters</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="usertype">GDBusMethodInvocation</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">invocation</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="usertype">gpointer</span><span class="normal">               user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">MyObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">myobj </span><span class="symbol">=</span><span class="normal"> user_data</span><span class="symbol">;</span>

<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">method_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"ChangeCount"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="usertype">gint</span><span class="normal"> change</span><span class="symbol">;</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get">g_variant_get</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">parameters</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"(i)"</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">change</span><span class="symbol">);</span>

<span class="normal">      </span><span class="function">my_object_change_count</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">myobj</span><span class="symbol">,</span><span class="normal"> change</span><span class="symbol">);</span>

<span class="normal">      </span><span class="function"><a href="GDBusMethodInvocation.html#g-dbus-method-invocation-return-value">g_dbus_method_invocation_return_value</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">invocation</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant">GVariant</a> </span><span class="symbol">*</span>
<span class="function">handle_get_property</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">  </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">interface_name</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">property_name</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">GError</span><span class="normal">          </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">gpointer</span><span class="normal">          user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GVariant</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">ret</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">MyObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">myobj </span><span class="symbol">=</span><span class="normal"> user_data</span><span class="symbol">;</span>

<span class="normal">  ret </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Count"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      ret </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-int32">g_variant_new_int32</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">myobj</span><span class="symbol">-&gt;</span><span class="normal">count</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Name"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      ret </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">myobj</span><span class="symbol">-&gt;</span><span class="normal">name </span><span class="symbol">?</span><span class="normal"> myobj</span><span class="symbol">-&gt;</span><span class="normal">name </span><span class="symbol">:</span><span class="normal"> </span><span class="string">""</span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> ret</span><span class="symbol">;</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean">gboolean</a></span>
<span class="function">handle_set_property</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal">  </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">sender</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">object_path</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">interface_name</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">property_name</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">GVariant</span><span class="normal">         </span><span class="symbol">*</span><span class="normal">value</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">GError</span><span class="normal">          </span><span class="symbol">**</span><span class="normal">error</span><span class="symbol">,</span>
<span class="normal">                     </span><span class="usertype">gpointer</span><span class="normal">          user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">MyObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">myobj </span><span class="symbol">=</span><span class="normal"> user_data</span><span class="symbol">;</span>

<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Count"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-set">g_object_set</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">myobj</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"count"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-int32">g_variant_get_int32</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value</span><span class="symbol">),</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">property_name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"Name"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-set">g_object_set</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">myobj</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"name"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-get-string">g_variant_get_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">value</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">),</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">    </span><span class="cbracket">}</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS">TRUE</a></span><span class="symbol">;</span>
<span class="cbracket">}</span>


<span class="comment">/* for now */</span>
<span class="keyword">static</span><span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">GDBusInterfaceVTable</span><span class="normal"> interface_vtable </span><span class="symbol">=</span>
<span class="cbracket">{</span>
<span class="normal">  handle_method_call</span><span class="symbol">,</span>
<span class="normal">  handle_get_property</span><span class="symbol">,</span>
<span class="normal">  handle_set_property</span>
<span class="cbracket">}</span><span class="symbol">;</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">send_property_change</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GObject</span><span class="normal">         </span><span class="symbol">*</span><span class="normal">obj</span><span class="symbol">,</span>
<span class="normal">                      </span><span class="usertype">GParamSpec</span><span class="normal">      </span><span class="symbol">*</span><span class="normal">pspec</span><span class="symbol">,</span>
<span class="normal">                      </span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GVariantBuilder</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">builder</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GVariantBuilder</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">invalidated_builder</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">MyObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">myobj </span><span class="symbol">=</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">MyObject </span><span class="symbol">*)</span><span class="normal">obj</span><span class="symbol">;</span>

<span class="normal">  builder </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-builder-new">g_variant_builder_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#G-VARIANT-TYPE-ARRAY:CAPS">G_VARIANT_TYPE_ARRAY</a></span><span class="symbol">);</span>
<span class="normal">  invalidated_builder </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-builder-new">g_variant_builder_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#G-VARIANT-TYPE:CAPS">G_VARIANT_TYPE</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"as"</span><span class="symbol">));</span>

<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">pspec</span><span class="symbol">-&gt;</span><span class="normal">name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"count"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">builder</span><span class="symbol">,</span>
<span class="normal">                           </span><span class="string">"{sv}"</span><span class="symbol">,</span>
<span class="normal">                           </span><span class="string">"Count"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-int32">g_variant_new_int32</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">myobj</span><span class="symbol">-&gt;</span><span class="normal">count</span><span class="symbol">));</span>
<span class="normal">  </span><span class="keyword">else</span><span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strcmp0">g_strcmp0</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">pspec</span><span class="symbol">-&gt;</span><span class="normal">name</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"name"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span>
<span class="normal">    </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-builder-add">g_variant_builder_add</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">builder</span><span class="symbol">,</span>
<span class="normal">                           </span><span class="string">"{sv}"</span><span class="symbol">,</span>
<span class="normal">                           </span><span class="string">"Name"</span><span class="symbol">,</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new-string">g_variant_new_string</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">myobj</span><span class="symbol">-&gt;</span><span class="normal">name </span><span class="symbol">?</span><span class="normal"> myobj</span><span class="symbol">-&gt;</span><span class="normal">name </span><span class="symbol">:</span><span class="normal"> </span><span class="string">""</span><span class="symbol">));</span>

<span class="normal">  </span><span class="function"><a href="GDBusConnection.html#g-dbus-connection-emit-signal">g_dbus_connection_emit_signal</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                                 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                                 </span><span class="string">"/org/myorg/MyObject"</span><span class="symbol">,</span>
<span class="normal">                                 </span><span class="string">"org.freedesktop.DBus.Properties"</span><span class="symbol">,</span>
<span class="normal">                                 </span><span class="string">"PropertiesChanged"</span><span class="symbol">,</span>
<span class="normal">                                 </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(sa{sv}as)"</span><span class="symbol">,</span>
<span class="normal">                                                </span><span class="string">"org.myorg.MyObject"</span><span class="symbol">,</span>
<span class="normal">                                                builder</span><span class="symbol">,</span>
<span class="normal">                                                invalidated_builder</span><span class="symbol">),</span>
<span class="normal">                                 <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">on_bus_acquired</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                 </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">,</span>
<span class="normal">                 </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">MyObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">myobj </span><span class="symbol">=</span><span class="normal"> user_data</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">guint</span><span class="normal"> registration_id</span><span class="symbol">;</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#g-signal-connect">g_signal_connect</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">myobj</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"notify"</span><span class="symbol">,</span>
<span class="normal">                    </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Closures.html#G-CALLBACK:CAPS">G_CALLBACK</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">send_property_change</span><span class="symbol">),</span><span class="normal"> connection</span><span class="symbol">);</span>
<span class="normal">  registration_id </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDBusConnection.html#g-dbus-connection-register-object">g_dbus_connection_register_object</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                                                       </span><span class="string">"/org/myorg/MyObject"</span><span class="symbol">,</span>
<span class="normal">                                                       introspection_data</span><span class="symbol">-&gt;</span><span class="normal">interfaces</span><span class="symbol">[</span><span class="number">0</span><span class="symbol">],</span>
<span class="normal">                                                       </span><span class="symbol">&amp;</span><span class="normal">interface_vtable</span><span class="symbol">,</span>
<span class="normal">                                                       myobj</span><span class="symbol">,</span>
<span class="normal">                                                       <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal">  </span><span class="comment">/* user_data_free_func */</span>
<span class="normal">                                                       <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span><span class="normal"> </span><span class="comment">/* GError** */</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">registration_id </span><span class="symbol">&gt;</span><span class="normal"> </span><span class="number">0</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">on_name_acquired</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="cbracket">}</span>

<span class="keyword">static</span><span class="normal"> </span><span class="type">void</span>
<span class="function">on_name_lost</span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">GDBusConnection</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">              </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">     </span><span class="symbol">*</span><span class="normal">name</span><span class="symbol">,</span>
<span class="normal">              </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="function">exit</span><span class="normal"> </span><span class="symbol">(</span><span class="number">1</span><span class="symbol">);</span>
<span class="cbracket">}</span>

<span class="type">int</span>
<span class="function">main</span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="normal"> argc</span><span class="symbol">,</span><span class="normal"> </span><span class="type">char</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">argv</span><span class="symbol">[])</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">guint</span><span class="normal"> owner_id</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GMainLoop</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">loop</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">MyObject</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">myobj</span><span class="symbol">;</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Type-Information.html#g-type-init">g_type_init</a></span><span class="normal"> </span><span class="symbol">();</span>

<span class="normal">  </span><span class="comment">/* We are lazy here - we don't want to manually provide</span>
<span class="comment">   * the introspection data structures - so we just build</span>
<span class="comment">   * them from XML.</span>
<span class="comment">   */</span>
<span class="normal">  introspection_data </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gio-D-Bus-Introspection-Data.html#g-dbus-node-info-new-for-xml">g_dbus_node_info_new_for_xml</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">introspection_xml</span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">introspection_data </span><span class="symbol">!=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="normal">  myobj </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-new">g_object_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">my_object_get_type</span><span class="normal"> </span><span class="symbol">(),</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="normal">  owner_id </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="gio-Owning-Bus-Names.html#g-bus-own-name">g_bus_own_name</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="GDBusConnection.html#G-BUS-TYPE-SESSION:CAPS">G_BUS_TYPE_SESSION</a></span><span class="symbol">,</span>
<span class="normal">                             </span><span class="string">"org.myorg.MyObject"</span><span class="symbol">,</span>
<span class="normal">                             <a href="gio-Owning-Bus-Names.html#G-BUS-NAME-OWNER-FLAGS-NONE:CAPS">G_BUS_NAME_OWNER_FLAGS_NONE</a></span><span class="symbol">,</span>
<span class="normal">                             on_bus_acquired</span><span class="symbol">,</span>
<span class="normal">                             on_name_acquired</span><span class="symbol">,</span>
<span class="normal">                             on_name_lost</span><span class="symbol">,</span>
<span class="normal">                             myobj</span><span class="symbol">,</span>
<span class="normal">                             <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>

<span class="normal">  loop </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-loop-new">g_main_loop_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">);</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-loop-run">g_main_loop_run</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">loop</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="gio-Owning-Bus-Names.html#g-bus-unown-name">g_bus_unown_name</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">owner_id</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="gio-D-Bus-Introspection-Data.html#g-dbus-node-info-unref">g_dbus_node_info_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">introspection_data</span><span class="symbol">);</span>

<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">myobj</span><span class="symbol">);</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> </span><span class="number">0</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<p><br class="example-break">
</p>
</div>
<div class="refsect1">
<a name="GDBusConnection.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GBusType"></a><h3>enum GBusType</h3>
<pre class="programlisting">typedef enum
{
  G_BUS_TYPE_STARTER = -1,
  G_BUS_TYPE_NONE = 0,
  G_BUS_TYPE_SYSTEM  = 1,
  G_BUS_TYPE_SESSION = 2
} GBusType;
</pre>
<p>
An enumeration for well-known message buses.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-BUS-TYPE-STARTER:CAPS"></a><span class="term"><code class="literal">G_BUS_TYPE_STARTER</code></span></p></td>
<td>An alias for the message bus that activated the process, if any.
</td>
</tr>
<tr>
<td><p><a name="G-BUS-TYPE-NONE:CAPS"></a><span class="term"><code class="literal">G_BUS_TYPE_NONE</code></span></p></td>
<td>Not a message bus.
</td>
</tr>
<tr>
<td><p><a name="G-BUS-TYPE-SYSTEM:CAPS"></a><span class="term"><code class="literal">G_BUS_TYPE_SYSTEM</code></span></p></td>
<td>The system-wide message bus.
</td>
</tr>
<tr>
<td><p><a name="G-BUS-TYPE-SESSION:CAPS"></a><span class="term"><code class="literal">G_BUS_TYPE_SESSION</code></span></p></td>
<td>The login session message bus.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-bus-get"></a><h3>g_bus_get ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_bus_get                           (<em class="parameter"><code><a class="link" href="GDBusConnection.html#GBusType"><span class="type">GBusType</span></a> bus_type</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
Asynchronously connects to the message bus specified by <em class="parameter"><code>bus_type</code></em>.
</p>
<p>
When the operation is finished, <em class="parameter"><code>callback</code></em> will be invoked. You can
then call <a class="link" href="GDBusConnection.html#g-bus-get-finish" title="g_bus_get_finish ()"><code class="function">g_bus_get_finish()</code></a> to get the result of the operation.
</p>
<p>
This is a asynchronous failable function. See <a class="link" href="GDBusConnection.html#g-bus-get-sync" title="g_bus_get_sync ()"><code class="function">g_bus_get_sync()</code></a> for
the synchronous version.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>bus_type</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html#GBusType"><span class="type">GBusType</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the request is satisfied.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The data to pass to <em class="parameter"><code>callback</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-bus-get-finish"></a><h3>g_bus_get_finish ()</h3>
<pre class="programlisting"><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   g_bus_get_finish                    (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Finishes an operation started with <a class="link" href="GDBusConnection.html#g-bus-get" title="g_bus_get ()"><code class="function">g_bus_get()</code></a>.
</p>
<p>
The returned object is a singleton, that is, shared with other
callers of <a class="link" href="GDBusConnection.html#g-bus-get" title="g_bus_get ()"><code class="function">g_bus_get()</code></a> and <a class="link" href="GDBusConnection.html#g-bus-get-sync" title="g_bus_get_sync ()"><code class="function">g_bus_get_sync()</code></a> for <em class="parameter"><code>bus_type</code></em>. In the
event that you need a private message bus connection, use
<code class="function">g_dbus_address_get_for_bus()</code> and
<a class="link" href="GDBusConnection.html#g-dbus-connection-new-for-address" title="g_dbus_connection_new_for_address ()"><code class="function">g_dbus_connection_new_for_address()</code></a>.
</p>
<p>
Note that the returned <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> object will (usually) have
the <a class="link" href="GDBusConnection.html#GDBusConnection--exit-on-close" title='The "exit-on-close" property'><span class="type">"exit-on-close"</span></a> property set to <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>res</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> obtained from the <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> passed to <a class="link" href="GDBusConnection.html#g-bus-get" title="g_bus_get ()"><code class="function">g_bus_get()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>error</code></em> is set. Free with <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-bus-get-sync"></a><h3>g_bus_get_sync ()</h3>
<pre class="programlisting"><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   g_bus_get_sync                      (<em class="parameter"><code><a class="link" href="GDBusConnection.html#GBusType"><span class="type">GBusType</span></a> bus_type</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Synchronously connects to the message bus specified by <em class="parameter"><code>bus_type</code></em>.
Note that the returned object may shared with other callers,
e.g. if two separate parts of a process calls this function with
the same <em class="parameter"><code>bus_type</code></em>, they will share the same object.
</p>
<p>
This is a synchronous failable function. See <a class="link" href="GDBusConnection.html#g-bus-get" title="g_bus_get ()"><code class="function">g_bus_get()</code></a> and
<a class="link" href="GDBusConnection.html#g-bus-get-finish" title="g_bus_get_finish ()"><code class="function">g_bus_get_finish()</code></a> for the asynchronous version.
</p>
<p>
The returned object is a singleton, that is, shared with other
callers of <a class="link" href="GDBusConnection.html#g-bus-get" title="g_bus_get ()"><code class="function">g_bus_get()</code></a> and <a class="link" href="GDBusConnection.html#g-bus-get-sync" title="g_bus_get_sync ()"><code class="function">g_bus_get_sync()</code></a> for <em class="parameter"><code>bus_type</code></em>. In the
event that you need a private message bus connection, use
<a class="link" href="gio-D-Bus-Addresses.html#g-dbus-address-get-for-bus-sync" title="g_dbus_address_get_for_bus_sync ()"><code class="function">g_dbus_address_get_for_bus_sync()</code></a> and
<a class="link" href="GDBusConnection.html#g-dbus-connection-new-for-address" title="g_dbus_connection_new_for_address ()"><code class="function">g_dbus_connection_new_for_address()</code></a>.
</p>
<p>
Note that the returned <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> object will (usually) have
the <a class="link" href="GDBusConnection.html#GDBusConnection--exit-on-close" title='The "exit-on-close" property'><span class="type">"exit-on-close"</span></a> property set to <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>bus_type</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html#GBusType"><span class="type">GBusType</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>error</code></em> is set. Free with <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusConnection-struct"></a><h3>GDBusConnection</h3>
<pre class="programlisting">typedef struct _GDBusConnection GDBusConnection;</pre>
<p>
The <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> structure contains only private data and
should only be accessed using the provided API.
</p>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusConnectionFlags"></a><h3>enum GDBusConnectionFlags</h3>
<pre class="programlisting">typedef enum {
  G_DBUS_CONNECTION_FLAGS_NONE = 0,
  G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT = (1&lt;&lt;0),
  G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER = (1&lt;&lt;1),
  G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS = (1&lt;&lt;2),
  G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION = (1&lt;&lt;3),
  G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING = (1&lt;&lt;4)
} GDBusConnectionFlags;
</pre>
<p>
Flags used when creating a new <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-DBUS-CONNECTION-FLAGS-NONE:CAPS"></a><span class="term"><code class="literal">G_DBUS_CONNECTION_FLAGS_NONE</code></span></p></td>
<td>No flags set.
</td>
</tr>
<tr>
<td><p><a name="G-DBUS-CONNECTION-FLAGS-AUTHENTICATION-CLIENT:CAPS"></a><span class="term"><code class="literal">G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT</code></span></p></td>
<td>Perform authentication against server.
</td>
</tr>
<tr>
<td><p><a name="G-DBUS-CONNECTION-FLAGS-AUTHENTICATION-SERVER:CAPS"></a><span class="term"><code class="literal">G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER</code></span></p></td>
<td>Perform authentication against client.
</td>
</tr>
<tr>
<td><p><a name="G-DBUS-CONNECTION-FLAGS-AUTHENTICATION-ALLOW-ANONYMOUS:CAPS"></a><span class="term"><code class="literal">G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS</code></span></p></td>
<td>When
authenticating as a server, allow the anonymous authentication
method.
</td>
</tr>
<tr>
<td><p><a name="G-DBUS-CONNECTION-FLAGS-MESSAGE-BUS-CONNECTION:CAPS"></a><span class="term"><code class="literal">G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION</code></span></p></td>
<td>Pass this flag if connecting to a peer that is a
message bus. This means that the <code class="function">Hello()</code> method will be invoked as part of the connection setup.
</td>
</tr>
<tr>
<td><p><a name="G-DBUS-CONNECTION-FLAGS-DELAY-MESSAGE-PROCESSING:CAPS"></a><span class="term"><code class="literal">G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING</code></span></p></td>
<td>If set, processing of D-Bus messages is
delayed until <a class="link" href="GDBusConnection.html#g-dbus-connection-start-message-processing" title="g_dbus_connection_start_message_processing ()"><code class="function">g_dbus_connection_start_message_processing()</code></a> is called.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-new"></a><h3>g_dbus_connection_new ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_dbus_connection_new               (<em class="parameter"><code><a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a> *stream</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *guid</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusConnectionFlags"><span class="type">GDBusConnectionFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> *observer</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
Asynchronously sets up a D-Bus connection for exchanging D-Bus messages
with the end represented by <em class="parameter"><code>stream</code></em>.
</p>
<p>
If <em class="parameter"><code>observer</code></em> is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> it may be used to control the
authentication process.
</p>
<p>
When the operation is finished, <em class="parameter"><code>callback</code></em> will be invoked. You can
then call <a class="link" href="GDBusConnection.html#g-dbus-connection-new-finish" title="g_dbus_connection_new_finish ()"><code class="function">g_dbus_connection_new_finish()</code></a> to get the result of the
operation.
</p>
<p>
This is a asynchronous failable constructor. See
<a class="link" href="GDBusConnection.html#g-dbus-connection-new-sync" title="g_dbus_connection_new_sync ()"><code class="function">g_dbus_connection_new_sync()</code></a> for the synchronous
version.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td>A <a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>guid</code></em> :</span></p></td>
<td>The GUID to use if a authenticating as a server or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>Flags describing how to make the connection.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>observer</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the request is satisfied.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The data to pass to <em class="parameter"><code>callback</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-new-finish"></a><h3>g_dbus_connection_new_finish ()</h3>
<pre class="programlisting"><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   g_dbus_connection_new_finish        (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Finishes an operation started with <a class="link" href="GDBusConnection.html#g-dbus-connection-new" title="g_dbus_connection_new ()"><code class="function">g_dbus_connection_new()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>res</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> obtained from the <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-new" title="g_dbus_connection_new ()"><code class="function">g_dbus_connection_new()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>error</code></em> is set. Free with <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-new-sync"></a><h3>g_dbus_connection_new_sync ()</h3>
<pre class="programlisting"><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   g_dbus_connection_new_sync          (<em class="parameter"><code><a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a> *stream</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *guid</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusConnectionFlags"><span class="type">GDBusConnectionFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> *observer</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Synchronously sets up a D-Bus connection for exchanging D-Bus messages
with the end represented by <em class="parameter"><code>stream</code></em>.
</p>
<p>
If <em class="parameter"><code>observer</code></em> is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> it may be used to control the
authentication process.
</p>
<p>
This is a synchronous failable constructor. See
<a class="link" href="GDBusConnection.html#g-dbus-connection-new" title="g_dbus_connection_new ()"><code class="function">g_dbus_connection_new()</code></a> for the asynchronous version.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>stream</code></em> :</span></p></td>
<td>A <a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>guid</code></em> :</span></p></td>
<td>The GUID to use if a authenticating as a server or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>Flags describing how to make the connection.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>observer</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>error</code></em> is set. Free with <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-new-for-address"></a><h3>g_dbus_connection_new_for_address ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_dbus_connection_new_for_address   (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *address</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusConnectionFlags"><span class="type">GDBusConnectionFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> *observer</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
Asynchronously connects and sets up a D-Bus client connection for
exchanging D-Bus messages with an endpoint specified by <em class="parameter"><code>address</code></em>
which must be in the D-Bus address format.
</p>
<p>
This constructor can only be used to initiate client-side
connections - use <a class="link" href="GDBusConnection.html#g-dbus-connection-new" title="g_dbus_connection_new ()"><code class="function">g_dbus_connection_new()</code></a> if you need to act as the
server. In particular, <em class="parameter"><code>flags</code></em> cannot contain the
<a class="link" href="GDBusConnection.html#G-DBUS-CONNECTION-FLAGS-AUTHENTICATION-SERVER:CAPS"><code class="literal">G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER</code></a> or
<a class="link" href="GDBusConnection.html#G-DBUS-CONNECTION-FLAGS-AUTHENTICATION-ALLOW-ANONYMOUS:CAPS"><code class="literal">G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS</code></a> flags.
</p>
<p>
When the operation is finished, <em class="parameter"><code>callback</code></em> will be invoked. You can
then call <a class="link" href="GDBusConnection.html#g-dbus-connection-new-finish" title="g_dbus_connection_new_finish ()"><code class="function">g_dbus_connection_new_finish()</code></a> to get the result of the
operation.
</p>
<p>
If <em class="parameter"><code>observer</code></em> is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> it may be used to control the
authentication process.
</p>
<p>
This is a asynchronous failable constructor. See
<a class="link" href="GDBusConnection.html#g-dbus-connection-new-for-address-sync" title="g_dbus_connection_new_for_address_sync ()"><code class="function">g_dbus_connection_new_for_address_sync()</code></a> for the synchronous
version.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>address</code></em> :</span></p></td>
<td>A D-Bus address.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>Flags describing how to make the connection.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>observer</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the request is satisfied.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The data to pass to <em class="parameter"><code>callback</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-new-for-address-finish"></a><h3>g_dbus_connection_new_for_address_finish ()</h3>
<pre class="programlisting"><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   g_dbus_connection_new_for_address_finish
                                                        (<em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Finishes an operation started with <a class="link" href="GDBusConnection.html#g-dbus-connection-new-for-address" title="g_dbus_connection_new_for_address ()"><code class="function">g_dbus_connection_new_for_address()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>res</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> obtained from the <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-new" title="g_dbus_connection_new ()"><code class="function">g_dbus_connection_new()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>error</code></em> is set. Free with <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-new-for-address-sync"></a><h3>g_dbus_connection_new_for_address_sync ()</h3>
<pre class="programlisting"><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="returnvalue">GDBusConnection</span></a> *   g_dbus_connection_new_for_address_sync
                                                        (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *address</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusConnectionFlags"><span class="type">GDBusConnectionFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> *observer</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Synchronously connects and sets up a D-Bus client connection for
exchanging D-Bus messages with an endpoint specified by <em class="parameter"><code>address</code></em>
which must be in the D-Bus address format.
</p>
<p>
This constructor can only be used to initiate client-side
connections - use <a class="link" href="GDBusConnection.html#g-dbus-connection-new-sync" title="g_dbus_connection_new_sync ()"><code class="function">g_dbus_connection_new_sync()</code></a> if you need to act
as the server. In particular, <em class="parameter"><code>flags</code></em> cannot contain the
<a class="link" href="GDBusConnection.html#G-DBUS-CONNECTION-FLAGS-AUTHENTICATION-SERVER:CAPS"><code class="literal">G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER</code></a> or
<a class="link" href="GDBusConnection.html#G-DBUS-CONNECTION-FLAGS-AUTHENTICATION-ALLOW-ANONYMOUS:CAPS"><code class="literal">G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS</code></a> flags.
</p>
<p>
This is a synchronous failable constructor. See
<a class="link" href="GDBusConnection.html#g-dbus-connection-new-for-address" title="g_dbus_connection_new_for_address ()"><code class="function">g_dbus_connection_new_for_address()</code></a> for the asynchronous version.
</p>
<p>
If <em class="parameter"><code>observer</code></em> is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> it may be used to control the
authentication process.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>address</code></em> :</span></p></td>
<td>A D-Bus address.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>Flags describing how to make the connection.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>observer</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>error</code></em> is set. Free with <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-start-message-processing"></a><h3>g_dbus_connection_start_message_processing ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_dbus_connection_start_message_processing
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);</pre>
<p>
If <em class="parameter"><code>connection</code></em> was created with
<a class="link" href="GDBusConnection.html#G-DBUS-CONNECTION-FLAGS-DELAY-MESSAGE-PROCESSING:CAPS"><code class="literal">G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING</code></a>, this method
starts processing messages. Does nothing on if <em class="parameter"><code>connection</code></em> wasn't
created with this flag or if the method has already been called.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-close"></a><h3>g_dbus_connection_close ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_dbus_connection_close             (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
Closes <em class="parameter"><code>connection</code></em>. Note that this never causes the process to
exit (this might only happen if the other end of a shared message
bus connection disconnects, see <a class="link" href="GDBusConnection.html#GDBusConnection--exit-on-close" title='The "exit-on-close" property'><span class="type">"exit-on-close"</span></a>).
</p>
<p>
Once the connection is closed, operations such as sending a message
will return with the error <a class="link" href="gio-GIOError.html#G-IO-ERROR-CLOSED:CAPS"><code class="literal">G_IO_ERROR_CLOSED</code></a>. Closing a connection
will not automatically flush the connection so queued messages may
be lost. Use <a class="link" href="GDBusConnection.html#g-dbus-connection-flush" title="g_dbus_connection_flush ()"><code class="function">g_dbus_connection_flush()</code></a> if you need such guarantees.
</p>
<p>
If <em class="parameter"><code>connection</code></em> is already closed, this method fails with
<a class="link" href="gio-GIOError.html#G-IO-ERROR-CLOSED:CAPS"><code class="literal">G_IO_ERROR_CLOSED</code></a>.
</p>
<p>
When <em class="parameter"><code>connection</code></em> has been closed, the <a class="link" href="GDBusConnection.html#GDBusConnection-closed" title='The "closed" signal'><span class="type">"closed"</span></a>
signal is emitted in the <GTKDOCLINK HREF="g-main-context-push-thread-default">thread-default main
loop</GTKDOCLINK> of the thread that <em class="parameter"><code>connection</code></em> was constructed in.
</p>
<p>
This is an asynchronous method. When the operation is finished,
<em class="parameter"><code>callback</code></em> will be invoked in the <GTKDOCLINK HREF="g-main-context-push-thread-default">thread-default main
loop</GTKDOCLINK> of the thread you are calling this method from. You can
then call <a class="link" href="GDBusConnection.html#g-dbus-connection-close-finish" title="g_dbus_connection_close_finish ()"><code class="function">g_dbus_connection_close_finish()</code></a> to get the result of the
operation.  See <a class="link" href="GDBusConnection.html#g-dbus-connection-close-sync" title="g_dbus_connection_close_sync ()"><code class="function">g_dbus_connection_close_sync()</code></a> for the synchronous
version.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the request is
satisfied or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if you don't care about the result. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The data to pass to <em class="parameter"><code>callback</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-close-finish"></a><h3>g_dbus_connection_close_finish ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_dbus_connection_close_finish      (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Finishes an operation started with <a class="link" href="GDBusConnection.html#g-dbus-connection-close" title="g_dbus_connection_close ()"><code class="function">g_dbus_connection_close()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>res</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> obtained from the <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-close" title="g_dbus_connection_close ()"><code class="function">g_dbus_connection_close()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the operation succeeded, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if <em class="parameter"><code>error</code></em> is set.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-close-sync"></a><h3>g_dbus_connection_close_sync ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_dbus_connection_close_sync        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Synchronously closees <em class="parameter"><code>connection</code></em>. The calling thread is blocked
until this is done. See <a class="link" href="GDBusConnection.html#g-dbus-connection-close" title="g_dbus_connection_close ()"><code class="function">g_dbus_connection_close()</code></a> for the
asynchronous version of this method and more details about what it
does.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the operation succeeded, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if <em class="parameter"><code>error</code></em> is set.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-is-closed"></a><h3>g_dbus_connection_is_closed ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_dbus_connection_is_closed         (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);</pre>
<p>
Gets whether <em class="parameter"><code>connection</code></em> is closed.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the connection is closed, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-flush"></a><h3>g_dbus_connection_flush ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_dbus_connection_flush             (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
Asynchronously flushes <em class="parameter"><code>connection</code></em>, that is, writes all queued
outgoing message to the transport and then flushes the transport
(using <a class="link" href="GOutputStream.html#g-output-stream-flush-async" title="g_output_stream_flush_async ()"><code class="function">g_output_stream_flush_async()</code></a>). This is useful in programs
that wants to emit a D-Bus signal and then exit
immediately. Without flushing the connection, there is no guarantee
that the message has been sent to the networking buffers in the OS
kernel.
</p>
<p>
This is an asynchronous method. When the operation is finished,
<em class="parameter"><code>callback</code></em> will be invoked in the <GTKDOCLINK HREF="g-main-context-push-thread-default">thread-default main
loop</GTKDOCLINK> of the thread you are calling this method from. You can
then call <a class="link" href="GDBusConnection.html#g-dbus-connection-flush-finish" title="g_dbus_connection_flush_finish ()"><code class="function">g_dbus_connection_flush_finish()</code></a> to get the result of the
operation.  See <a class="link" href="GDBusConnection.html#g-dbus-connection-flush-sync" title="g_dbus_connection_flush_sync ()"><code class="function">g_dbus_connection_flush_sync()</code></a> for the synchronous
version.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the request is
satisfied or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if you don't care about the result. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The data to pass to <em class="parameter"><code>callback</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-flush-finish"></a><h3>g_dbus_connection_flush_finish ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_dbus_connection_flush_finish      (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Finishes an operation started with <a class="link" href="GDBusConnection.html#g-dbus-connection-flush" title="g_dbus_connection_flush ()"><code class="function">g_dbus_connection_flush()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>res</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> obtained from the <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-flush" title="g_dbus_connection_flush ()"><code class="function">g_dbus_connection_flush()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the operation succeeded, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if <em class="parameter"><code>error</code></em> is set.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-flush-sync"></a><h3>g_dbus_connection_flush_sync ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_dbus_connection_flush_sync        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Synchronously flushes <em class="parameter"><code>connection</code></em>. The calling thread is blocked
until this is done. See <a class="link" href="GDBusConnection.html#g-dbus-connection-flush" title="g_dbus_connection_flush ()"><code class="function">g_dbus_connection_flush()</code></a> for the
asynchronous version of this method and more details about what it
does.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the operation succeeded, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if <em class="parameter"><code>error</code></em> is set.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-get-exit-on-close"></a><h3>g_dbus_connection_get_exit_on_close ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_dbus_connection_get_exit_on_close (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);</pre>
<p>
Gets whether the process is terminated when <em class="parameter"><code>connection</code></em> is
closed by the remote peer. See
<a class="link" href="GDBusConnection.html#GDBusConnection--exit-on-close" title='The "exit-on-close" property'><span class="type">"exit-on-close"</span></a> for more details.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>Whether the process is terminated when <em class="parameter"><code>connection</code></em> is
closed by the remote peer.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-set-exit-on-close"></a><h3>g_dbus_connection_set_exit_on_close ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_dbus_connection_set_exit_on_close (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> exit_on_close</code></em>);</pre>
<p>
Sets whether the process should be terminated when <em class="parameter"><code>connection</code></em> is
closed by the remote peer. See <a class="link" href="GDBusConnection.html#GDBusConnection--exit-on-close" title='The "exit-on-close" property'><span class="type">"exit-on-close"</span></a> for
more details.
</p>
<p>
Note that this function should be used with care. Most modern UNIX
desktops tie the notion of a user session the session bus, and expect
all of a users applications to quit when their bus connection goes away.
If you are setting <em class="parameter"><code>exit_on_close</code></em> to <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> for the shared session
bus connection, you should make sure that your application exits
when the user session ends.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>exit_on_close</code></em> :</span></p></td>
<td>Whether the process should be terminated
when <em class="parameter"><code>connection</code></em> is closed by the remote peer.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-get-stream"></a><h3>g_dbus_connection_get_stream ()</h3>
<pre class="programlisting"><a class="link" href="GIOStream.html" title="GIOStream"><span class="returnvalue">GIOStream</span></a> *         g_dbus_connection_get_stream        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);</pre>
<p>
Gets the underlying stream used for IO.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>a <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the stream used for IO. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-get-guid"></a><h3>g_dbus_connection_get_guid ()</h3>
<pre class="programlisting">const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       g_dbus_connection_get_guid          (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);</pre>
<p>
The GUID of the peer performing the role of server when
authenticating. See <a class="link" href="GDBusConnection.html#GDBusConnection--guid" title='The "guid" property'><span class="type">"guid"</span></a> for more details.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The GUID. Do not free this string, it is owned by
<em class="parameter"><code>connection</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-get-unique-name"></a><h3>g_dbus_connection_get_unique_name ()</h3>
<pre class="programlisting">const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       g_dbus_connection_get_unique_name   (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);</pre>
<p>
Gets the unique name of <em class="parameter"><code>connection</code></em> as assigned by the message
bus. This can also be used to figure out if <em class="parameter"><code>connection</code></em> is a
message bus connection.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The unique name or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>connection</code></em> is not a message
bus connection. Do not free this string, it is owned by
<em class="parameter"><code>connection</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusCapabilityFlags"></a><h3>enum GDBusCapabilityFlags</h3>
<pre class="programlisting">typedef enum {
  G_DBUS_CAPABILITY_FLAGS_NONE = 0,
  G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING = (1&lt;&lt;0)
} GDBusCapabilityFlags;
</pre>
<p>
Capabilities negotiated with the remote peer.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-DBUS-CAPABILITY-FLAGS-NONE:CAPS"></a><span class="term"><code class="literal">G_DBUS_CAPABILITY_FLAGS_NONE</code></span></p></td>
<td>No flags set.
</td>
</tr>
<tr>
<td><p><a name="G-DBUS-CAPABILITY-FLAGS-UNIX-FD-PASSING:CAPS"></a><span class="term"><code class="literal">G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING</code></span></p></td>
<td>The connection
supports exchanging UNIX file descriptors with the remote peer.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-get-capabilities"></a><h3>g_dbus_connection_get_capabilities ()</h3>
<pre class="programlisting"><a class="link" href="GDBusConnection.html#GDBusCapabilityFlags"><span class="returnvalue">GDBusCapabilityFlags</span></a>  g_dbus_connection_get_capabilities
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);</pre>
<p>
Gets the capabilities negotiated with the remote peer
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>Zero or more flags from the <a class="link" href="GDBusConnection.html#GDBusCapabilityFlags"><span class="type">GDBusCapabilityFlags</span></a> enumeration.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-get-peer-credentials"></a><h3>g_dbus_connection_get_peer_credentials ()</h3>
<pre class="programlisting"><a class="link" href="GCredentials.html" title="GCredentials"><span class="returnvalue">GCredentials</span></a> *      g_dbus_connection_get_peer_credentials
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>);</pre>
<p>
Gets the credentials of the authenticated peer. This will always
return <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> unless <em class="parameter"><code>connection</code></em> acted as a server
(e.g. <a class="link" href="GDBusConnection.html#G-DBUS-CONNECTION-FLAGS-AUTHENTICATION-SERVER:CAPS"><code class="literal">G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER</code></a> was passed)
when set up and the client passed credentials as part of the
authentication process.
</p>
<p>
In a message bus setup, the message bus is always the server and
each application is a client. So this method will always return
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for message bus clients.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a class="link" href="GCredentials.html" title="GCredentials"><span class="type">GCredentials</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not available. Do not free
this object, it is owned by <em class="parameter"><code>connection</code></em>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusCallFlags"></a><h3>enum GDBusCallFlags</h3>
<pre class="programlisting">typedef enum {
  G_DBUS_CALL_FLAGS_NONE = 0,
  G_DBUS_CALL_FLAGS_NO_AUTO_START = (1&lt;&lt;0)
} GDBusCallFlags;
</pre>
<p>
Flags used in <a class="link" href="GDBusConnection.html#g-dbus-connection-call" title="g_dbus_connection_call ()"><code class="function">g_dbus_connection_call()</code></a> and similar APIs.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-DBUS-CALL-FLAGS-NONE:CAPS"></a><span class="term"><code class="literal">G_DBUS_CALL_FLAGS_NONE</code></span></p></td>
<td>No flags set.
</td>
</tr>
<tr>
<td><p><a name="G-DBUS-CALL-FLAGS-NO-AUTO-START:CAPS"></a><span class="term"><code class="literal">G_DBUS_CALL_FLAGS_NO_AUTO_START</code></span></p></td>
<td>The bus must not launch
an owner for the destination name in response to this method
invocation.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-call"></a><h3>g_dbus_connection_call ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_dbus_connection_call              (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *bus_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *method_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameters</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *reply_type</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusCallFlags" title="enum GDBusCallFlags"><span class="type">GDBusCallFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> timeout_msec</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
Asynchronously invokes the <em class="parameter"><code>method_name</code></em> method on the
<em class="parameter"><code>interface_name</code></em> D-Bus interface on the remote object at
<em class="parameter"><code>object_path</code></em> owned by <em class="parameter"><code>bus_name</code></em>.
</p>
<p>
If <em class="parameter"><code>connection</code></em> is closed then the operation will fail with
<a class="link" href="gio-GIOError.html#G-IO-ERROR-CLOSED:CAPS"><code class="literal">G_IO_ERROR_CLOSED</code></a>. If <em class="parameter"><code>cancellable</code></em> is canceled, the operation will
fail with <a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a>. If <em class="parameter"><code>parameters</code></em> contains a value
not compatible with the D-Bus protocol, the operation fails with
<a class="link" href="gio-GIOError.html#G-IO-ERROR-INVALID-ARGUMENT:CAPS"><code class="literal">G_IO_ERROR_INVALID_ARGUMENT</code></a>.
</p>
<p>
If <em class="parameter"><code>reply_type</code></em> is non-<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then the reply will be checked for having this type and an
error will be raised if it does not match.  Said another way, if you give a <em class="parameter"><code>reply_type</code></em>
then any non-<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> return value will be of this type.
</p>
<p>
If the <em class="parameter"><code>parameters</code></em> <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> is floating, it is consumed. This allows
convenient 'inline' use of <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new"><code class="function">g_variant_new()</code></a>, e.g.:
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="function"><a href="GDBusConnection.html#g-dbus-connection-call">g_dbus_connection_call</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="string">"org.freedesktop.StringThings"</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="string">"/org/freedesktop/StringThings"</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="string">"org.freedesktop.StringThings"</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="string">"TwoStrings"</span><span class="symbol">,</span>
<span class="normal">                        </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(ss)"</span><span class="symbol">,</span>
<span class="normal">                                       </span><span class="string">"Thing One"</span><span class="symbol">,</span>
<span class="normal">                                       </span><span class="string">"Thing Two"</span><span class="symbol">),</span>
<span class="normal">                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                        <a href="GDBusConnection.html#G-DBUS-CALL-FLAGS-NONE:CAPS">G_DBUS_CALL_FLAGS_NONE</a></span><span class="symbol">,</span>
<span class="normal">                        </span><span class="symbol">-</span><span class="number">1</span><span class="symbol">,</span>
<span class="normal">                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                        </span><span class="symbol">(</span><span class="normal"><a href="GAsyncResult.html#GAsyncReadyCallback">GAsyncReadyCallback</a></span><span class="symbol">)</span><span class="normal"> two_strings_done</span><span class="symbol">,</span>
<span class="normal">                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<p>
This is an asynchronous method. When the operation is finished, <em class="parameter"><code>callback</code></em> will be invoked
in the <a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-context-push-thread-default">thread-default main loop</a>
of the thread you are calling this method from. You can then call
<a class="link" href="GDBusConnection.html#g-dbus-connection-call-finish" title="g_dbus_connection_call_finish ()"><code class="function">g_dbus_connection_call_finish()</code></a> to get the result of the operation.
See <a class="link" href="GDBusConnection.html#g-dbus-connection-call-sync" title="g_dbus_connection_call_sync ()"><code class="function">g_dbus_connection_call_sync()</code></a> for the synchronous version of this
function.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>bus_name</code></em> :</span></p></td>
<td>A unique or well-known bus name or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if
<em class="parameter"><code>connection</code></em> is not a message bus connection. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>Path of remote object.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interface_name</code></em> :</span></p></td>
<td>D-Bus interface to invoke method on.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>method_name</code></em> :</span></p></td>
<td>The name of the method to invoke.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>parameters</code></em> :</span></p></td>
<td>A <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> tuple with parameters for the method
or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not passing parameters. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>reply_type</code></em> :</span></p></td>
<td>The expected type of the reply, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>Flags from the <a class="link" href="GDBusConnection.html#GDBusCallFlags" title="enum GDBusCallFlags"><span class="type">GDBusCallFlags</span></a> enumeration.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>timeout_msec</code></em> :</span></p></td>
<td>The timeout in milliseconds, -1 to use the default
timeout or <a href="http://library.gnome.org/devel/glib/unstable/glib-Limits-of-Basic-Types.html#G-MAXINT:CAPS"><code class="literal">G_MAXINT</code></a> for no timeout.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the request is
satisfied or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if you don't * care about the result of the
method invocation. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The data to pass to <em class="parameter"><code>callback</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-call-finish"></a><h3>g_dbus_connection_call_finish ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="returnvalue">GVariant</span></a> *          g_dbus_connection_call_finish       (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Finishes an operation started with <a class="link" href="GDBusConnection.html#g-dbus-connection-call" title="g_dbus_connection_call ()"><code class="function">g_dbus_connection_call()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>res</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> obtained from the <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-call" title="g_dbus_connection_call ()"><code class="function">g_dbus_connection_call()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>error</code></em> is set. Otherwise a <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> tuple with
return values. Free with <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-unref"><code class="function">g_variant_unref()</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-call-sync"></a><h3>g_dbus_connection_call_sync ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="returnvalue">GVariant</span></a> *          g_dbus_connection_call_sync         (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *bus_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *method_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameters</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariantType.html#GVariantType"><span class="type">GVariantType</span></a> *reply_type</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusCallFlags" title="enum GDBusCallFlags"><span class="type">GDBusCallFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> timeout_msec</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Synchronously invokes the <em class="parameter"><code>method_name</code></em> method on the
<em class="parameter"><code>interface_name</code></em> D-Bus interface on the remote object at
<em class="parameter"><code>object_path</code></em> owned by <em class="parameter"><code>bus_name</code></em>.
</p>
<p>
If <em class="parameter"><code>connection</code></em> is closed then the operation will fail with
<a class="link" href="gio-GIOError.html#G-IO-ERROR-CLOSED:CAPS"><code class="literal">G_IO_ERROR_CLOSED</code></a>. If <em class="parameter"><code>cancellable</code></em> is canceled, the
operation will fail with <a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a>. If <em class="parameter"><code>parameters</code></em>
contains a value not compatible with the D-Bus protocol, the operation
fails with <a class="link" href="gio-GIOError.html#G-IO-ERROR-INVALID-ARGUMENT:CAPS"><code class="literal">G_IO_ERROR_INVALID_ARGUMENT</code></a>.
</p>
<p>
If <em class="parameter"><code>reply_type</code></em> is non-<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then the reply will be checked for having
this type and an error will be raised if it does not match.  Said
another way, if you give a <em class="parameter"><code>reply_type</code></em> then any non-<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> return
value will be of this type.
</p>
<p>
If the <em class="parameter"><code>parameters</code></em> <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> is floating, it is consumed.
This allows convenient 'inline' use of <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new"><code class="function">g_variant_new()</code></a>, e.g.:
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="function"><a href="GDBusConnection.html#g-dbus-connection-call-sync">g_dbus_connection_call_sync</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">connection</span><span class="symbol">,</span>
<span class="normal">                             </span><span class="string">"org.freedesktop.StringThings"</span><span class="symbol">,</span>
<span class="normal">                             </span><span class="string">"/org/freedesktop/StringThings"</span><span class="symbol">,</span>
<span class="normal">                             </span><span class="string">"org.freedesktop.StringThings"</span><span class="symbol">,</span>
<span class="normal">                             </span><span class="string">"TwoStrings"</span><span class="symbol">,</span>
<span class="normal">                             </span><span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-new">g_variant_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"(ss)"</span><span class="symbol">,</span>
<span class="normal">                                            </span><span class="string">"Thing One"</span><span class="symbol">,</span>
<span class="normal">                                            </span><span class="string">"Thing Two"</span><span class="symbol">),</span>
<span class="normal">                             <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                             <a href="GDBusConnection.html#G-DBUS-CALL-FLAGS-NONE:CAPS">G_DBUS_CALL_FLAGS_NONE</a></span><span class="symbol">,</span>
<span class="normal">                             </span><span class="symbol">-</span><span class="number">1</span><span class="symbol">,</span>
<span class="normal">                             <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span>
<span class="normal">                             </span><span class="symbol">&amp;</span><span class="normal">error</span><span class="symbol">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<p>
The calling thread is blocked until a reply is received. See
<a class="link" href="GDBusConnection.html#g-dbus-connection-call" title="g_dbus_connection_call ()"><code class="function">g_dbus_connection_call()</code></a> for the asynchronous version of
this method.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>bus_name</code></em> :</span></p></td>
<td>A unique or well-known bus name.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>Path of remote object.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interface_name</code></em> :</span></p></td>
<td>D-Bus interface to invoke method on.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>method_name</code></em> :</span></p></td>
<td>The name of the method to invoke.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>parameters</code></em> :</span></p></td>
<td>A <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> tuple with parameters for the method
or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not passing parameters. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>reply_type</code></em> :</span></p></td>
<td>The expected type of the reply, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>Flags from the <a class="link" href="GDBusConnection.html#GDBusCallFlags" title="enum GDBusCallFlags"><span class="type">GDBusCallFlags</span></a> enumeration.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>timeout_msec</code></em> :</span></p></td>
<td>The timeout in milliseconds, -1 to use the default
timeout or <a href="http://library.gnome.org/devel/glib/unstable/glib-Limits-of-Basic-Types.html#G-MAXINT:CAPS"><code class="literal">G_MAXINT</code></a> for no timeout.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>error</code></em> is set. Otherwise a <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> tuple with
return values. Free with <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#g-variant-unref"><code class="function">g_variant_unref()</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-emit-signal"></a><h3>g_dbus_connection_emit_signal ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_dbus_connection_emit_signal       (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *destination_bus_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *signal_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameters</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Emits a signal.
</p>
<p>
If the parameters GVariant is floating, it is consumed.
</p>
<p>
This can only fail if <em class="parameter"><code>parameters</code></em> is not compatible with the D-Bus protocol.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>destination_bus_name</code></em> :</span></p></td>
<td>The unique bus name for the destination
for the signal or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to emit to all listeners. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>Path of remote object.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interface_name</code></em> :</span></p></td>
<td>D-Bus interface to emit a signal on.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>signal_name</code></em> :</span></p></td>
<td>The name of the signal to emit.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>parameters</code></em> :</span></p></td>
<td>A <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> tuple with parameters for the signal
or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if not passing parameters. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> unless <em class="parameter"><code>error</code></em> is set.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusSignalFlags"></a><h3>enum GDBusSignalFlags</h3>
<pre class="programlisting">typedef enum /*&lt; flags &gt;*/
{
  G_DBUS_SIGNAL_FLAGS_NONE = 0,
  G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE = (1&lt;&lt;0)
} GDBusSignalFlags;
</pre>
<p>
Flags used when subscribing to signals via <a class="link" href="GDBusConnection.html#g-dbus-connection-signal-subscribe" title="g_dbus_connection_signal_subscribe ()"><code class="function">g_dbus_connection_signal_subscribe()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-DBUS-SIGNAL-FLAGS-NONE:CAPS"></a><span class="term"><code class="literal">G_DBUS_SIGNAL_FLAGS_NONE</code></span></p></td>
<td>No flags set.
</td>
</tr>
<tr>
<td><p><a name="G-DBUS-SIGNAL-FLAGS-NO-MATCH-RULE:CAPS"></a><span class="term"><code class="literal">G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE</code></span></p></td>
<td>Don't actually send the AddMatch
D-Bus call for this signal subscription.  This gives you more control
over which match rules you add (but you must add them manually).
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusSignalCallback"></a><h3>GDBusSignalCallback ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                (*GDBusSignalCallback)              (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *signal_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameters</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
Signature for callback function used in <a class="link" href="GDBusConnection.html#g-dbus-connection-signal-subscribe" title="g_dbus_connection_signal_subscribe ()"><code class="function">g_dbus_connection_signal_subscribe()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sender_name</code></em> :</span></p></td>
<td>The unique bus name of the sender of the signal.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>The object path that the signal was emitted on.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interface_name</code></em> :</span></p></td>
<td>The name of the interface.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>signal_name</code></em> :</span></p></td>
<td>The name of the signal.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>parameters</code></em> :</span></p></td>
<td>A <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> tuple with parameters for the signal.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>User data passed when subscribing to the signal.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-signal-subscribe"></a><h3>g_dbus_connection_signal_subscribe ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               g_dbus_connection_signal_subscribe  (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *member</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *arg0</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusSignalFlags" title="enum GDBusSignalFlags"><span class="type">GDBusSignalFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusSignalCallback" title="GDBusSignalCallback ()"><span class="type">GDBusSignalCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> user_data_free_func</code></em>);</pre>
<p>
Subscribes to signals on <em class="parameter"><code>connection</code></em> and invokes <em class="parameter"><code>callback</code></em> with a
whenever the signal is received. Note that <em class="parameter"><code>callback</code></em>
will be invoked in the <GTKDOCLINK HREF="g-main-context-push-thread-default">thread-default main
loop</GTKDOCLINK> of the thread you are calling this method from.
</p>
<p>
If <em class="parameter"><code>connection</code></em> is not a message bus connection, <em class="parameter"><code>sender</code></em> must be
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
</p>
<p>
If <em class="parameter"><code>sender</code></em> is a well-known name note that <em class="parameter"><code>callback</code></em> is invoked with
the unique name for the owner of <em class="parameter"><code>sender</code></em>, not the well-known name
as one would expect. This is because the message bus rewrites the
name. As such, to avoid certain race conditions, users should be
tracking the name owner of the well-known name and use that when
processing the received signal.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sender</code></em> :</span></p></td>
<td>Sender name to match on (unique or well-known name)
or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to listen from all senders. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interface_name</code></em> :</span></p></td>
<td>D-Bus interface name to match on or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to
match on all interfaces. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>member</code></em> :</span></p></td>
<td>D-Bus signal name to match on or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to match on all signals. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>Object path to match on or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to match on all object paths. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>arg0</code></em> :</span></p></td>
<td>Contents of first string argument to match on or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
to match on all kinds of arguments. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>Flags describing how to subscribe to the signal (currently unused).</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
<td>Callback to invoke when there is a signal matching the requested data.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>User data to pass to <em class="parameter"><code>callback</code></em>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data_free_func</code></em> :</span></p></td>
<td>Function to free <em class="parameter"><code>user_data</code></em> with when subscription is removed or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A subscription identifier that can be used with <a class="link" href="GDBusConnection.html#g-dbus-connection-signal-unsubscribe" title="g_dbus_connection_signal_unsubscribe ()"><code class="function">g_dbus_connection_signal_unsubscribe()</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-signal-unsubscribe"></a><h3>g_dbus_connection_signal_unsubscribe ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_dbus_connection_signal_unsubscribe
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> subscription_id</code></em>);</pre>
<p>
Unsubscribes from signals.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>subscription_id</code></em> :</span></p></td>
<td>A subscription id obtained from <a class="link" href="GDBusConnection.html#g-dbus-connection-signal-subscribe" title="g_dbus_connection_signal_subscribe ()"><code class="function">g_dbus_connection_signal_subscribe()</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusSendMessageFlags"></a><h3>enum GDBusSendMessageFlags</h3>
<pre class="programlisting">typedef enum
{
  G_DBUS_SEND_MESSAGE_FLAGS_NONE = 0,
  G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL = (1&lt;&lt;0)
} GDBusSendMessageFlags;
</pre>
<p>
Flags used when sending <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a>s on a <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-DBUS-SEND-MESSAGE-FLAGS-NONE:CAPS"></a><span class="term"><code class="literal">G_DBUS_SEND_MESSAGE_FLAGS_NONE</code></span></p></td>
<td>No flags set.
</td>
</tr>
<tr>
<td><p><a name="G-DBUS-SEND-MESSAGE-FLAGS-PRESERVE-SERIAL:CAPS"></a><span class="term"><code class="literal">G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL</code></span></p></td>
<td>Do not automatically
assign a serial number from the <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> object when
sending a message.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-send-message"></a><h3>g_dbus_connection_send_message ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_dbus_connection_send_message      (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> *message</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusSendMessageFlags" title="enum GDBusSendMessageFlags"><span class="type">GDBusSendMessageFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code>volatile <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> *out_serial</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Asynchronously sends <em class="parameter"><code>message</code></em> to the peer represented by <em class="parameter"><code>connection</code></em>.
</p>
<p>
Unless <em class="parameter"><code>flags</code></em> contain the
<a class="link" href="GDBusConnection.html#G-DBUS-SEND-MESSAGE-FLAGS-PRESERVE-SERIAL:CAPS"><code class="literal">G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL</code></a> flag, the serial number
will be assigned by <em class="parameter"><code>connection</code></em> and set on <em class="parameter"><code>message</code></em> via
<a class="link" href="GDBusMessage.html#g-dbus-message-set-serial" title="g_dbus_message_set_serial ()"><code class="function">g_dbus_message_set_serial()</code></a>. If <em class="parameter"><code>out_serial</code></em> is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then the
serial number used will be written to this location prior to
submitting the message to the underlying transport.
</p>
<p>
If <em class="parameter"><code>connection</code></em> is closed then the operation will fail with
<a class="link" href="gio-GIOError.html#G-IO-ERROR-CLOSED:CAPS"><code class="literal">G_IO_ERROR_CLOSED</code></a>. If <em class="parameter"><code>message</code></em> is not well-formed,
the operation fails with <a class="link" href="gio-GIOError.html#G-IO-ERROR-INVALID-ARGUMENT:CAPS"><code class="literal">G_IO_ERROR_INVALID_ARGUMENT</code></a>.
</p>
<p>
See <a class="xref" href="GDBusConnection.html#gdbus-server" title="Example 2. D-Bus server example">Example 2, “D-Bus server example”</a> and <a class="xref" href="GDBusConnection.html#gdbus-unix-fd-client" title="Example 4. D-Bus UNIX File Descriptor example">Example 4, “D-Bus UNIX File Descriptor example”</a> for an example of how to use this
low-level API to send and receive UNIX file descriptors.
</p>
<p>
Note that <em class="parameter"><code>message</code></em> must be unlocked, unless <em class="parameter"><code>flags</code></em> contain the
<a class="link" href="GDBusConnection.html#G-DBUS-SEND-MESSAGE-FLAGS-PRESERVE-SERIAL:CAPS"><code class="literal">G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL</code></a> flag.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>message</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>Flags affecting how the message is sent.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out_serial</code></em> :</span></p></td>
<td>Return location for serial number assigned
to <em class="parameter"><code>message</code></em> when sending it or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the message was well-formed and queued for
transmission, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if <em class="parameter"><code>error</code></em> is set.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-send-message-with-reply"></a><h3>g_dbus_connection_send_message_with_reply ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_dbus_connection_send_message_with_reply
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> *message</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusSendMessageFlags" title="enum GDBusSendMessageFlags"><span class="type">GDBusSendMessageFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> timeout_msec</code></em>,
                                                         <em class="parameter"><code>volatile <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> *out_serial</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
Asynchronously sends <em class="parameter"><code>message</code></em> to the peer represented by <em class="parameter"><code>connection</code></em>.
</p>
<p>
Unless <em class="parameter"><code>flags</code></em> contain the
<a class="link" href="GDBusConnection.html#G-DBUS-SEND-MESSAGE-FLAGS-PRESERVE-SERIAL:CAPS"><code class="literal">G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL</code></a> flag, the serial number
will be assigned by <em class="parameter"><code>connection</code></em> and set on <em class="parameter"><code>message</code></em> via
<a class="link" href="GDBusMessage.html#g-dbus-message-set-serial" title="g_dbus_message_set_serial ()"><code class="function">g_dbus_message_set_serial()</code></a>. If <em class="parameter"><code>out_serial</code></em> is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then the
serial number used will be written to this location prior to
submitting the message to the underlying transport.
</p>
<p>
If <em class="parameter"><code>connection</code></em> is closed then the operation will fail with
<a class="link" href="gio-GIOError.html#G-IO-ERROR-CLOSED:CAPS"><code class="literal">G_IO_ERROR_CLOSED</code></a>. If <em class="parameter"><code>cancellable</code></em> is canceled, the operation will
fail with <a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a>. If <em class="parameter"><code>message</code></em> is not well-formed,
the operation fails with <a class="link" href="gio-GIOError.html#G-IO-ERROR-INVALID-ARGUMENT:CAPS"><code class="literal">G_IO_ERROR_INVALID_ARGUMENT</code></a>.
</p>
<p>
This is an asynchronous method. When the operation is finished, <em class="parameter"><code>callback</code></em> will be invoked
in the <a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-context-push-thread-default">thread-default main loop</a>
of the thread you are calling this method from. You can then call
<a class="link" href="GDBusConnection.html#g-dbus-connection-send-message-with-reply-finish" title="g_dbus_connection_send_message_with_reply_finish ()"><code class="function">g_dbus_connection_send_message_with_reply_finish()</code></a> to get the result of the operation.
See <a class="link" href="GDBusConnection.html#g-dbus-connection-send-message-with-reply-sync" title="g_dbus_connection_send_message_with_reply_sync ()"><code class="function">g_dbus_connection_send_message_with_reply_sync()</code></a> for the synchronous version.
</p>
<p>
Note that <em class="parameter"><code>message</code></em> must be unlocked, unless <em class="parameter"><code>flags</code></em> contain the
<a class="link" href="GDBusConnection.html#G-DBUS-SEND-MESSAGE-FLAGS-PRESERVE-SERIAL:CAPS"><code class="literal">G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL</code></a> flag.
</p>
<p>
See <a class="xref" href="GDBusConnection.html#gdbus-server" title="Example 2. D-Bus server example">Example 2, “D-Bus server example”</a> and <a class="xref" href="GDBusConnection.html#gdbus-unix-fd-client" title="Example 4. D-Bus UNIX File Descriptor example">Example 4, “D-Bus UNIX File Descriptor example”</a> for an example of how to use this
low-level API to send and receive UNIX file descriptors.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>message</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>Flags affecting how the message is sent.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>timeout_msec</code></em> :</span></p></td>
<td>The timeout in milliseconds, -1 to use the default
timeout or <a href="http://library.gnome.org/devel/glib/unstable/glib-Limits-of-Basic-Types.html#G-MAXINT:CAPS"><code class="literal">G_MAXINT</code></a> for no timeout.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out_serial</code></em> :</span></p></td>
<td>Return location for serial number assigned
to <em class="parameter"><code>message</code></em> when sending it or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the request is
satisfied or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if you don't care about the result. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The data to pass to <em class="parameter"><code>callback</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-send-message-with-reply-finish"></a><h3>g_dbus_connection_send_message_with_reply_finish ()</h3>
<pre class="programlisting"><a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="returnvalue">GDBusMessage</span></a> *      g_dbus_connection_send_message_with_reply_finish
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *res</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Finishes an operation started with <a class="link" href="GDBusConnection.html#g-dbus-connection-send-message-with-reply" title="g_dbus_connection_send_message_with_reply ()"><code class="function">g_dbus_connection_send_message_with_reply()</code></a>.
</p>
<p>
Note that <em class="parameter"><code>error</code></em> is only set if a local in-process error
occured. That is to say that the returned <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> object may
be of type <a class="link" href="GDBusMessage.html#G-DBUS-MESSAGE-TYPE-ERROR:CAPS"><code class="literal">G_DBUS_MESSAGE_TYPE_ERROR</code></a>. Use
<a class="link" href="GDBusMessage.html#g-dbus-message-to-gerror" title="g_dbus_message_to_gerror ()"><code class="function">g_dbus_message_to_gerror()</code></a> to transcode this to a <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>.
</p>
<p>
See <a class="xref" href="GDBusConnection.html#gdbus-server" title="Example 2. D-Bus server example">Example 2, “D-Bus server example”</a> and <a class="xref" href="GDBusConnection.html#gdbus-unix-fd-client" title="Example 4. D-Bus UNIX File Descriptor example">Example 4, “D-Bus UNIX File Descriptor example”</a> for an example of how to use this
low-level API to send and receive UNIX file descriptors.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>a <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>res</code></em> :</span></p></td>
<td>A <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> obtained from the <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-send-message-with-reply" title="g_dbus_connection_send_message_with_reply ()"><code class="function">g_dbus_connection_send_message_with_reply()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A locked <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>error</code></em> is set. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-send-message-with-reply-sync"></a><h3>g_dbus_connection_send_message_with_reply_sync ()</h3>
<pre class="programlisting"><a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="returnvalue">GDBusMessage</span></a> *      g_dbus_connection_send_message_with_reply_sync
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> *message</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusSendMessageFlags" title="enum GDBusSendMessageFlags"><span class="type">GDBusSendMessageFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a> timeout_msec</code></em>,
                                                         <em class="parameter"><code>volatile <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> *out_serial</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Synchronously sends <em class="parameter"><code>message</code></em> to the peer represented by <em class="parameter"><code>connection</code></em>
and blocks the calling thread until a reply is received or the
timeout is reached. See <a class="link" href="GDBusConnection.html#g-dbus-connection-send-message-with-reply" title="g_dbus_connection_send_message_with_reply ()"><code class="function">g_dbus_connection_send_message_with_reply()</code></a>
for the asynchronous version of this method.
</p>
<p>
Unless <em class="parameter"><code>flags</code></em> contain the
<a class="link" href="GDBusConnection.html#G-DBUS-SEND-MESSAGE-FLAGS-PRESERVE-SERIAL:CAPS"><code class="literal">G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL</code></a> flag, the serial number
will be assigned by <em class="parameter"><code>connection</code></em> and set on <em class="parameter"><code>message</code></em> via
<a class="link" href="GDBusMessage.html#g-dbus-message-set-serial" title="g_dbus_message_set_serial ()"><code class="function">g_dbus_message_set_serial()</code></a>. If <em class="parameter"><code>out_serial</code></em> is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then the
serial number used will be written to this location prior to
submitting the message to the underlying transport.
</p>
<p>
If <em class="parameter"><code>connection</code></em> is closed then the operation will fail with
<a class="link" href="gio-GIOError.html#G-IO-ERROR-CLOSED:CAPS"><code class="literal">G_IO_ERROR_CLOSED</code></a>. If <em class="parameter"><code>cancellable</code></em> is canceled, the operation will
fail with <a class="link" href="gio-GIOError.html#G-IO-ERROR-CANCELLED:CAPS"><code class="literal">G_IO_ERROR_CANCELLED</code></a>. If <em class="parameter"><code>message</code></em> is not well-formed,
the operation fails with <a class="link" href="gio-GIOError.html#G-IO-ERROR-INVALID-ARGUMENT:CAPS"><code class="literal">G_IO_ERROR_INVALID_ARGUMENT</code></a>.
</p>
<p>
Note that <em class="parameter"><code>error</code></em> is only set if a local in-process error
occured. That is to say that the returned <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> object may
be of type <a class="link" href="GDBusMessage.html#G-DBUS-MESSAGE-TYPE-ERROR:CAPS"><code class="literal">G_DBUS_MESSAGE_TYPE_ERROR</code></a>. Use
<a class="link" href="GDBusMessage.html#g-dbus-message-to-gerror" title="g_dbus_message_to_gerror ()"><code class="function">g_dbus_message_to_gerror()</code></a> to transcode this to a <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>.
</p>
<p>
See <a class="xref" href="GDBusConnection.html#gdbus-server" title="Example 2. D-Bus server example">Example 2, “D-Bus server example”</a> and <a class="xref" href="GDBusConnection.html#gdbus-unix-fd-client" title="Example 4. D-Bus UNIX File Descriptor example">Example 4, “D-Bus UNIX File Descriptor example”</a> for an example of how to use this
low-level API to send and receive UNIX file descriptors.
</p>
<p>
Note that <em class="parameter"><code>message</code></em> must be unlocked, unless <em class="parameter"><code>flags</code></em> contain the
<a class="link" href="GDBusConnection.html#G-DBUS-SEND-MESSAGE-FLAGS-PRESERVE-SERIAL:CAPS"><code class="literal">G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL</code></a> flag.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>message</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>Flags affecting how the message is sent.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>timeout_msec</code></em> :</span></p></td>
<td>The timeout in milliseconds, -1 to use the default
timeout or <a href="http://library.gnome.org/devel/glib/unstable/glib-Limits-of-Basic-Types.html#G-MAXINT:CAPS"><code class="literal">G_MAXINT</code></a> for no timeout.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out_serial</code></em> :</span></p></td>
<td>Return location for serial number assigned
to <em class="parameter"><code>message</code></em> when sending it or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
<td>A <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A locked <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> that is the reply to <em class="parameter"><code>message</code></em> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if <em class="parameter"><code>error</code></em> is set. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusMessageFilterFunction"></a><h3>GDBusMessageFilterFunction ()</h3>
<pre class="programlisting"><a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="returnvalue">GDBusMessage</span></a> *      (*GDBusMessageFilterFunction)       (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> *message</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> incoming</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
Signature for function used in <a class="link" href="GDBusConnection.html#g-dbus-connection-add-filter" title="g_dbus_connection_add_filter ()"><code class="function">g_dbus_connection_add_filter()</code></a>.
</p>
<p>
A filter function is passed a <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> and expected to return
a <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> too. Passive filter functions that don't modify the
message can simply return the <em class="parameter"><code>message</code></em> object:
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="keyword">static</span><span class="normal"> <a href="GDBusMessage.html">GDBusMessage</a> </span><span class="symbol">*</span>
<span class="function">passive_filter</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="GDBusConnection.html">GDBusConnection</a> </span><span class="symbol">*</span><span class="normal">connection</span>
<span class="normal">                </span><span class="usertype">GDBusMessage</span><span class="normal">    </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">,</span>
<span class="normal">                </span><span class="usertype">gboolean</span><span class="normal">         incoming</span><span class="symbol">,</span>
<span class="normal">                </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="comment">/* inspect @message */</span>
<span class="normal">  </span><span class="keyword">return</span><span class="normal"> message</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
Filter functions that wants to drop a message can simply return <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>:
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="keyword">static</span><span class="normal"> <a href="GDBusMessage.html">GDBusMessage</a> </span><span class="symbol">*</span>
<span class="function">drop_filter</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="GDBusConnection.html">GDBusConnection</a> </span><span class="symbol">*</span><span class="normal">connection</span>
<span class="normal">             </span><span class="usertype">GDBusMessage</span><span class="normal">    </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">,</span>
<span class="normal">             </span><span class="usertype">gboolean</span><span class="normal">         incoming</span><span class="symbol">,</span>
<span class="normal">             </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">should_drop_message</span><span class="symbol">)</span>
<span class="normal">    </span><span class="cbracket">{</span>
<span class="normal">      </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">message</span><span class="symbol">);</span>
<span class="normal">      message </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">    </span><span class="cbracket">}</span>
<span class="normal">  </span><span class="keyword">return</span><span class="normal"> message</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
Finally, a filter function may modify a message by copying it:
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="keyword">static</span><span class="normal"> <a href="GDBusMessage.html">GDBusMessage</a> </span><span class="symbol">*</span>
<span class="function">modifying_filter</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="GDBusConnection.html">GDBusConnection</a> </span><span class="symbol">*</span><span class="normal">connection</span>
<span class="normal">                  </span><span class="usertype">GDBusMessage</span><span class="normal">    </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="usertype">gboolean</span><span class="normal">         incoming</span><span class="symbol">,</span>
<span class="normal">                  </span><span class="usertype">gpointer</span><span class="normal">         user_data</span><span class="symbol">)</span>
<span class="cbracket">{</span>
<span class="normal">  </span><span class="usertype">GDBusMessage</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">copy</span><span class="symbol">;</span>
<span class="normal">  </span><span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error</span><span class="symbol">;</span>

<span class="normal">  error </span><span class="symbol">=</span><span class="normal"> <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">  copy </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDBusMessage.html#g-dbus-message-copy">g_dbus_message_copy</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">message</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&amp;</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal">  </span><span class="comment">/* handle @error being is set */</span>
<span class="normal">  </span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">message</span><span class="symbol">);</span>

<span class="normal">  </span><span class="comment">/* modify @copy */</span>

<span class="normal">  </span><span class="keyword">return</span><span class="normal"> copy</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
If the returned <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> is different from <em class="parameter"><code>message</code></em> and cannot
be sent on <em class="parameter"><code>connection</code></em> (it could use features, such as file
descriptors, not compatible with <em class="parameter"><code>connection</code></em>), then a warning is
logged to <span class="emphasis"><em>standard error</em></span>. Applications can
check this ahead of time using <a class="link" href="GDBusMessage.html#g-dbus-message-to-blob" title="g_dbus_message_to_blob ()"><code class="function">g_dbus_message_to_blob()</code></a> passing a
<a class="link" href="GDBusConnection.html#GDBusCapabilityFlags"><span class="type">GDBusCapabilityFlags</span></a> value obtained from <em class="parameter"><code>connection</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>message</code></em> :</span></p></td>
<td>A locked <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> that the filter function takes ownership of. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>incoming</code></em> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if it is a message received from the other peer, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if it is
a message to be sent to the other peer.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>User data passed when adding the filter.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a class="link" href="GDBusMessage.html" title="GDBusMessage"><span class="type">GDBusMessage</span></a> that will be freed with
<a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to drop the message. Passive filter
functions can simply return the passed <em class="parameter"><code>message</code></em> object. <span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>][<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-add-filter"></a><h3>g_dbus_connection_add_filter ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               g_dbus_connection_add_filter        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusMessageFilterFunction" title="GDBusMessageFilterFunction ()"><span class="type">GDBusMessageFilterFunction</span></a> filter_function</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> user_data_free_func</code></em>);</pre>
<p>
Adds a message filter. Filters are handlers that are run on all
incoming and outgoing messages, prior to standard dispatch. Filters
are run in the order that they were added.  The same handler can be
added as a filter more than once, in which case it will be run more
than once.  Filters added during a filter callback won't be run on
the message being processed. Filter functions are allowed to modify
and even drop messages - see the <span class="type">GDBusMessageFilterResult</span>
enumeration for details.
</p>
<p>
Note that filters are run in a dedicated message handling thread so
they can't block and, generally, can't do anything but signal a
worker thread. Also note that filters are rarely needed - use API
such as <a class="link" href="GDBusConnection.html#g-dbus-connection-send-message-with-reply" title="g_dbus_connection_send_message_with_reply ()"><code class="function">g_dbus_connection_send_message_with_reply()</code></a>,
<a class="link" href="GDBusConnection.html#g-dbus-connection-signal-subscribe" title="g_dbus_connection_signal_subscribe ()"><code class="function">g_dbus_connection_signal_subscribe()</code></a> or
<a class="link" href="GDBusConnection.html#g-dbus-connection-call" title="g_dbus_connection_call ()"><code class="function">g_dbus_connection_call()</code></a> instead.
</p>
<p>
If a filter consumes an incoming message the message is not
dispatched anywhere else - not even the standard dispatch machinery
(that API such as <a class="link" href="GDBusConnection.html#g-dbus-connection-signal-subscribe" title="g_dbus_connection_signal_subscribe ()"><code class="function">g_dbus_connection_signal_subscribe()</code></a> and
<a class="link" href="GDBusConnection.html#g-dbus-connection-send-message-with-reply" title="g_dbus_connection_send_message_with_reply ()"><code class="function">g_dbus_connection_send_message_with_reply()</code></a> relies on) will see the
message. Similary, if a filter consumes an outgoing message, the
message will not be sent to the other peer.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>filter_function</code></em> :</span></p></td>
<td>A filter function.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>User data to pass to <em class="parameter"><code>filter_function</code></em>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data_free_func</code></em> :</span></p></td>
<td>Function to free <em class="parameter"><code>user_data</code></em> with when filter
is removed or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A filter identifier that can be used with
<a class="link" href="GDBusConnection.html#g-dbus-connection-remove-filter" title="g_dbus_connection_remove_filter ()"><code class="function">g_dbus_connection_remove_filter()</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-remove-filter"></a><h3>g_dbus_connection_remove_filter ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_dbus_connection_remove_filter     (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> filter_id</code></em>);</pre>
<p>
Removes a filter.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>a <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>filter_id</code></em> :</span></p></td>
<td>an identifier obtained from <a class="link" href="GDBusConnection.html#g-dbus-connection-add-filter" title="g_dbus_connection_add_filter ()"><code class="function">g_dbus_connection_add_filter()</code></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusInterfaceVTable"></a><h3>GDBusInterfaceVTable</h3>
<pre class="programlisting">typedef struct {
  GDBusInterfaceMethodCallFunc  method_call;
  GDBusInterfaceGetPropertyFunc get_property;
  GDBusInterfaceSetPropertyFunc set_property;
} GDBusInterfaceVTable;
</pre>
<p>
Virtual table for handling properties and method calls for a D-Bus
interface.
</p>
<p>
If you want to handle getting/setting D-Bus properties asynchronously, simply
register an object with the <code class="literal">org.freedesktop.DBus.Properties</code>
D-Bus interface using <a class="link" href="GDBusConnection.html#g-dbus-connection-register-object" title="g_dbus_connection_register_object ()"><code class="function">g_dbus_connection_register_object()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a class="link" href="GDBusConnection.html#GDBusInterfaceMethodCallFunc" title="GDBusInterfaceMethodCallFunc ()"><span class="type">GDBusInterfaceMethodCallFunc</span></a> <em class="structfield"><code><a name="GDBusInterfaceVTable.method-call"></a>method_call</code></em>;</span></p></td>
<td>Function for handling incoming method calls.</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="GDBusConnection.html#GDBusInterfaceGetPropertyFunc" title="GDBusInterfaceGetPropertyFunc ()"><span class="type">GDBusInterfaceGetPropertyFunc</span></a> <em class="structfield"><code><a name="GDBusInterfaceVTable.get-property"></a>get_property</code></em>;</span></p></td>
<td>Function for getting a property.</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="GDBusConnection.html#GDBusInterfaceSetPropertyFunc" title="GDBusInterfaceSetPropertyFunc ()"><span class="type">GDBusInterfaceSetPropertyFunc</span></a> <em class="structfield"><code><a name="GDBusInterfaceVTable.set-property"></a>set_property</code></em>;</span></p></td>
<td>Function for setting a property.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusInterfaceMethodCallFunc"></a><h3>GDBusInterfaceMethodCallFunc ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                (*GDBusInterfaceMethodCallFunc)     (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *method_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *parameters</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusMethodInvocation.html" title="GDBusMethodInvocation"><span class="type">GDBusMethodInvocation</span></a> *invocation</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
The type of the <em class="parameter"><code>method_call</code></em> function in <a class="link" href="GDBusConnection.html#GDBusInterfaceVTable" title="GDBusInterfaceVTable"><span class="type">GDBusInterfaceVTable</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sender</code></em> :</span></p></td>
<td>The unique bus name of the remote caller.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>The object path that the method was invoked on.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interface_name</code></em> :</span></p></td>
<td>The D-Bus interface name the method was invoked on.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>method_name</code></em> :</span></p></td>
<td>The name of the method that was invoked.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>parameters</code></em> :</span></p></td>
<td>A <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> tuple with parameters.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>invocation</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusMethodInvocation.html" title="GDBusMethodInvocation"><span class="type">GDBusMethodInvocation</span></a> object that can be used to return a value or error.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The <em class="parameter"><code>user_data</code></em> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-register-object" title="g_dbus_connection_register_object ()"><code class="function">g_dbus_connection_register_object()</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusInterfaceGetPropertyFunc"></a><h3>GDBusInterfaceGetPropertyFunc ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="returnvalue">GVariant</span></a> *          (*GDBusInterfaceGetPropertyFunc)    (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *property_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
The type of the <em class="parameter"><code>get_property</code></em> function in <a class="link" href="GDBusConnection.html#GDBusInterfaceVTable" title="GDBusInterfaceVTable"><span class="type">GDBusInterfaceVTable</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sender</code></em> :</span></p></td>
<td>The unique bus name of the remote caller.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>The object path that the method was invoked on.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interface_name</code></em> :</span></p></td>
<td>The D-Bus interface name for the property.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>property_name</code></em> :</span></p></td>
<td>The name of the property to get the value of.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The <em class="parameter"><code>user_data</code></em> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-register-object" title="g_dbus_connection_register_object ()"><code class="function">g_dbus_connection_register_object()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> with the value for <em class="parameter"><code>property_name</code></em> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if
<em class="parameter"><code>error</code></em> is set. If the returned <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> is floating, it is
consumed - otherwise its reference count is decreased by one.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusInterfaceSetPropertyFunc"></a><h3>GDBusInterfaceSetPropertyFunc ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            (*GDBusInterfaceSetPropertyFunc)    (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *property_name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> *value</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
The type of the <em class="parameter"><code>set_property</code></em> function in <a class="link" href="GDBusConnection.html#GDBusInterfaceVTable" title="GDBusInterfaceVTable"><span class="type">GDBusInterfaceVTable</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sender</code></em> :</span></p></td>
<td>The unique bus name of the remote caller.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>The object path that the method was invoked on.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interface_name</code></em> :</span></p></td>
<td>The D-Bus interface name for the property.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>property_name</code></em> :</span></p></td>
<td>The name of the property to get the value of.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>value</code></em> :</span></p></td>
<td>The value to set the property to.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The <em class="parameter"><code>user_data</code></em> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-register-object" title="g_dbus_connection_register_object ()"><code class="function">g_dbus_connection_register_object()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the property was set to <em class="parameter"><code>value</code></em>, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if <em class="parameter"><code>error</code></em> is set.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-register-object"></a><h3>g_dbus_connection_register_object ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               g_dbus_connection_register_object   (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gio-D-Bus-Introspection-Data.html#GDBusInterfaceInfo"><span class="type">GDBusInterfaceInfo</span></a> *interface_info</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="GDBusConnection.html#GDBusInterfaceVTable" title="GDBusInterfaceVTable"><span class="type">GDBusInterfaceVTable</span></a> *vtable</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> user_data_free_func</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Registers callbacks for exported objects at <em class="parameter"><code>object_path</code></em> with the
D-Bus interface that is described in <em class="parameter"><code>interface_info</code></em>.
</p>
<p>
Calls to functions in <em class="parameter"><code>vtable</code></em> (and <em class="parameter"><code>user_data_free_func</code></em>) will
happen in the <GTKDOCLINK HREF="g-main-context-push-thread-default">thread-default main
loop</GTKDOCLINK> of the thread you are calling this method from.
</p>
<p>
Note that all <a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> values passed to functions in <em class="parameter"><code>vtable</code></em> will match
the signature given in <em class="parameter"><code>interface_info</code></em> - if a remote caller passes
incorrect values, the <code class="literal">org.freedesktop.DBus.Error.InvalidArgs</code>
is returned to the remote caller.
</p>
<p>
Additionally, if the remote caller attempts to invoke methods or
access properties not mentioned in <em class="parameter"><code>interface_info</code></em> the
<code class="literal">org.freedesktop.DBus.Error.UnknownMethod</code> resp.
<code class="literal">org.freedesktop.DBus.Error.InvalidArgs</code> errors
are returned to the caller.
</p>
<p>
It is considered a programming error if the
<a class="link" href="GDBusConnection.html#GDBusInterfaceGetPropertyFunc" title="GDBusInterfaceGetPropertyFunc ()"><span class="type">GDBusInterfaceGetPropertyFunc</span></a> function in <em class="parameter"><code>vtable</code></em> returns a
<a href="http://library.gnome.org/devel/glib/unstable/glib-GVariant.html#GVariant"><span class="type">GVariant</span></a> of incorrect type.
</p>
<p>
If an existing callback is already registered at <em class="parameter"><code>object_path</code></em> and
<em class="parameter"><code>interface_name</code></em>, then <em class="parameter"><code>error</code></em> is set to <a class="link" href="gio-GIOError.html#G-IO-ERROR-EXISTS:CAPS"><span class="type">G_IO_ERROR_EXISTS</span></a>.
</p>
<p>
GDBus automatically implements the standard D-Bus interfaces
org.freedesktop.DBus.Properties, org.freedesktop.DBus.Introspectable
and org.freedesktop.Peer, so you don't have to implement those for
the objects you export. You <span class="emphasis"><em>can</em></span> implement
org.freedesktop.DBus.Properties yourself, e.g. to handle getting
and setting of properties asynchronously.
</p>
<p>
Note that the reference count on <em class="parameter"><code>interface_info</code></em> will be
incremented by 1 (unless allocated statically, e.g. if the
reference count is -1, see <a class="link" href="gio-D-Bus-Introspection-Data.html#g-dbus-interface-info-ref" title="g_dbus_interface_info_ref ()"><code class="function">g_dbus_interface_info_ref()</code></a>) for as long
as the object is exported. Also note that <em class="parameter"><code>vtable</code></em> will be copied.
</p>
<p>
A <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> <em class="parameter"><code>vtable</code></em> can be used for
<a class="ulink" href="http://en.wikipedia.org/wiki/Marker_interface_pattern" target="_top">marker
interfaces</a>.
</p>
<p>
See <a class="xref" href="GDBusConnection.html#gdbus-server" title="Example 2. D-Bus server example">Example 2, “D-Bus server example”</a> for an example of how to use this
method.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>The object path to register at</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interface_info</code></em> :</span></p></td>
<td>Introspection data for the interface</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>vtable</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html#GDBusInterfaceVTable" title="GDBusInterfaceVTable"><span class="type">GDBusInterfaceVTable</span></a> to call into, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>Data to pass to functions in <em class="parameter"><code>vtable</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data_free_func</code></em> :</span></p></td>
<td>Function to call when the object path is unregistered</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 if <em class="parameter"><code>error</code></em> is set, otherwise a registration id (never 0)
that can be used with <a class="link" href="GDBusConnection.html#g-dbus-connection-unregister-object" title="g_dbus_connection_unregister_object ()"><code class="function">g_dbus_connection_unregister_object()</code></a> .</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-unregister-object"></a><h3>g_dbus_connection_unregister_object ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_dbus_connection_unregister_object (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> registration_id</code></em>);</pre>
<p>
Unregisters an object.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>registration_id</code></em> :</span></p></td>
<td>A registration id obtained from <a class="link" href="GDBusConnection.html#g-dbus-connection-register-object" title="g_dbus_connection_register_object ()"><code class="function">g_dbus_connection_register_object()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the object was unregistered, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusSubtreeVTable"></a><h3>GDBusSubtreeVTable</h3>
<pre class="programlisting">typedef struct {
  GDBusSubtreeEnumerateFunc  enumerate;
  GDBusSubtreeIntrospectFunc introspect;
  GDBusSubtreeDispatchFunc   dispatch;
} GDBusSubtreeVTable;
</pre>
<p>
Virtual table for handling subtrees registered with <a class="link" href="GDBusConnection.html#g-dbus-connection-register-subtree" title="g_dbus_connection_register_subtree ()"><code class="function">g_dbus_connection_register_subtree()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a class="link" href="GDBusConnection.html#GDBusSubtreeEnumerateFunc" title="GDBusSubtreeEnumerateFunc ()"><span class="type">GDBusSubtreeEnumerateFunc</span></a> <em class="structfield"><code><a name="GDBusSubtreeVTable.enumerate"></a>enumerate</code></em>;</span></p></td>
<td>Function for enumerating child nodes.</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="GDBusConnection.html#GDBusSubtreeIntrospectFunc" title="GDBusSubtreeIntrospectFunc ()"><span class="type">GDBusSubtreeIntrospectFunc</span></a> <em class="structfield"><code><a name="GDBusSubtreeVTable.introspect"></a>introspect</code></em>;</span></p></td>
<td>Function for introspecting a child node.</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="GDBusConnection.html#GDBusSubtreeDispatchFunc" title="GDBusSubtreeDispatchFunc ()"><span class="type">GDBusSubtreeDispatchFunc</span></a> <em class="structfield"><code><a name="GDBusSubtreeVTable.dispatch"></a>dispatch</code></em>;</span></p></td>
<td>Function for dispatching a remote call on a child node.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusSubtreeEnumerateFunc"></a><h3>GDBusSubtreeEnumerateFunc ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> **            (*GDBusSubtreeEnumerateFunc)        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
The type of the <em class="parameter"><code>enumerate</code></em> function in <a class="link" href="GDBusConnection.html#GDBusSubtreeVTable" title="GDBusSubtreeVTable"><span class="type">GDBusSubtreeVTable</span></a>.
</p>
<p>
This function is called when generating introspection data and also
when preparing to dispatch incoming messages in the event that the
<a class="link" href="GDBusConnection.html#G-DBUS-SUBTREE-FLAGS-DISPATCH-TO-UNENUMERATED-NODES:CAPS"><code class="literal">G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES</code></a> flag is not
specified (ie: to verify that the object path is valid).
</p>
<p>
Hierarchies are not supported; the items that you return should not
contain the '/' character.
</p>
<p>
The return value will be freed with <a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html#g-strfreev"><code class="function">g_strfreev()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sender</code></em> :</span></p></td>
<td>The unique bus name of the remote caller.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>The object path that was registered with <a class="link" href="GDBusConnection.html#g-dbus-connection-register-subtree" title="g_dbus_connection_register_subtree ()"><code class="function">g_dbus_connection_register_subtree()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The <em class="parameter"><code>user_data</code></em> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-register-subtree" title="g_dbus_connection_register_subtree ()"><code class="function">g_dbus_connection_register_subtree()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A newly allocated array of strings for node names that are children of <em class="parameter"><code>object_path</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusSubtreeIntrospectFunc"></a><h3>GDBusSubtreeIntrospectFunc ()</h3>
<pre class="programlisting"><a class="link" href="gio-D-Bus-Introspection-Data.html#GDBusInterfaceInfo"><span class="returnvalue">GDBusInterfaceInfo</span></a> ** (*GDBusSubtreeIntrospectFunc)     (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *node</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
The type of the <em class="parameter"><code>introspect</code></em> function in <a class="link" href="GDBusConnection.html#GDBusSubtreeVTable" title="GDBusSubtreeVTable"><span class="type">GDBusSubtreeVTable</span></a>.
</p>
<p>
Subtrees are flat.  <em class="parameter"><code>node</code></em>, if non-<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, is always exactly one
segment of the object path (ie: it never contains a slash).
</p>
<p>
This function should return <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to indicate that there is no object
at this node.
</p>
<p>
If this function returns non-<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the return value is expected to
be a <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of pointers to <a class="link" href="gio-D-Bus-Introspection-Data.html#GDBusInterfaceInfo"><span class="type">GDBusInterfaceInfo</span></a>
structures describing the interfaces implemented by <em class="parameter"><code>node</code></em>.  This
array will have <a class="link" href="gio-D-Bus-Introspection-Data.html#g-dbus-interface-info-unref" title="g_dbus_interface_info_unref ()"><code class="function">g_dbus_interface_info_unref()</code></a> called on each item
before being freed with <a href="http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>.
</p>
<p>
The difference between returning <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> and an array containing zero
items is that the standard DBus interfaces will returned to the
remote introspector in the empty array case, but not in the <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
case.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sender</code></em> :</span></p></td>
<td>The unique bus name of the remote caller.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>The object path that was registered with <a class="link" href="GDBusConnection.html#g-dbus-connection-register-subtree" title="g_dbus_connection_register_subtree ()"><code class="function">g_dbus_connection_register_subtree()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
<td>A node that is a child of <em class="parameter"><code>object_path</code></em> (relative to <em class="parameter"><code>object_path</code></em>) or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for the root of the subtree.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The <em class="parameter"><code>user_data</code></em> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-register-subtree" title="g_dbus_connection_register_subtree ()"><code class="function">g_dbus_connection_register_subtree()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of pointers to <a class="link" href="gio-D-Bus-Introspection-Data.html#GDBusInterfaceInfo"><span class="type">GDBusInterfaceInfo</span></a>, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusSubtreeDispatchFunc"></a><h3>GDBusSubtreeDispatchFunc ()</h3>
<pre class="programlisting">const <a class="link" href="GDBusConnection.html#GDBusInterfaceVTable" title="GDBusInterfaceVTable"><span class="returnvalue">GDBusInterfaceVTable</span></a> * (*GDBusSubtreeDispatchFunc)
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *sender</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *interface_name</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *node</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> *out_user_data</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
The type of the <em class="parameter"><code>dispatch</code></em> function in <a class="link" href="GDBusConnection.html#GDBusSubtreeVTable" title="GDBusSubtreeVTable"><span class="type">GDBusSubtreeVTable</span></a>.
</p>
<p>
Subtrees are flat.  <em class="parameter"><code>node</code></em>, if non-<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, is always exactly one
segment of the object path (ie: it never contains a slash).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sender</code></em> :</span></p></td>
<td>The unique bus name of the remote caller.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>The object path that was registered with <a class="link" href="GDBusConnection.html#g-dbus-connection-register-subtree" title="g_dbus_connection_register_subtree ()"><code class="function">g_dbus_connection_register_subtree()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interface_name</code></em> :</span></p></td>
<td>The D-Bus interface name that the method call or property access is for.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
<td>A node that is a child of <em class="parameter"><code>object_path</code></em> (relative to <em class="parameter"><code>object_path</code></em>) or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for the root of the subtree.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out_user_data</code></em> :</span></p></td>
<td>Return location for user data to pass to functions in the returned <a class="link" href="GDBusConnection.html#GDBusInterfaceVTable" title="GDBusInterfaceVTable"><span class="type">GDBusInterfaceVTable</span></a> (never <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>).</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>The <em class="parameter"><code>user_data</code></em> <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-register-subtree" title="g_dbus_connection_register_subtree ()"><code class="function">g_dbus_connection_register_subtree()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html#GDBusInterfaceVTable" title="GDBusInterfaceVTable"><span class="type">GDBusInterfaceVTable</span></a> or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if you don't want to handle the methods.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusSubtreeFlags"></a><h3>enum GDBusSubtreeFlags</h3>
<pre class="programlisting">typedef enum
{
  G_DBUS_SUBTREE_FLAGS_NONE = 0,
  G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES = (1&lt;&lt;0)
} GDBusSubtreeFlags;
</pre>
<p>
Flags passed to <a class="link" href="GDBusConnection.html#g-dbus-connection-register-subtree" title="g_dbus_connection_register_subtree ()"><code class="function">g_dbus_connection_register_subtree()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-DBUS-SUBTREE-FLAGS-NONE:CAPS"></a><span class="term"><code class="literal">G_DBUS_SUBTREE_FLAGS_NONE</code></span></p></td>
<td>No flags set.
</td>
</tr>
<tr>
<td><p><a name="G-DBUS-SUBTREE-FLAGS-DISPATCH-TO-UNENUMERATED-NODES:CAPS"></a><span class="term"><code class="literal">G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES</code></span></p></td>
<td>Method calls to objects not in the enumerated range
                                                      will still be dispatched. This is useful if you want
                                                      to dynamically spawn objects in the subtree.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-register-subtree"></a><h3>g_dbus_connection_register_subtree ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="returnvalue">guint</span></a>               g_dbus_connection_register_subtree  (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *object_path</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="GDBusConnection.html#GDBusSubtreeVTable" title="GDBusSubtreeVTable"><span class="type">GDBusSubtreeVTable</span></a> *vtable</code></em>,
                                                         <em class="parameter"><code><a class="link" href="GDBusConnection.html#GDBusSubtreeFlags" title="enum GDBusSubtreeFlags"><span class="type">GDBusSubtreeFlags</span></a> flags</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> user_data_free_func</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
Registers a whole subtree of <span class="quote">“<span class="quote">dynamic</span>”</span> objects.
</p>
<p>
The <em class="parameter"><code>enumerate</code></em> and <em class="parameter"><code>introspection</code></em> functions in <em class="parameter"><code>vtable</code></em> are used to
convey, to remote callers, what nodes exist in the subtree rooted
by <em class="parameter"><code>object_path</code></em>.
</p>
<p>
When handling remote calls into any node in the subtree, first the
<em class="parameter"><code>enumerate</code></em> function is used to check if the node exists. If the node exists
or the <a class="link" href="GDBusConnection.html#G-DBUS-SUBTREE-FLAGS-DISPATCH-TO-UNENUMERATED-NODES:CAPS"><span class="type">G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES</span></a> flag is set
the <em class="parameter"><code>introspection</code></em> function is used to check if the node supports the
requested method. If so, the <em class="parameter"><code>dispatch</code></em> function is used to determine
where to dispatch the call. The collected <a class="link" href="GDBusConnection.html#GDBusInterfaceVTable" title="GDBusInterfaceVTable"><span class="type">GDBusInterfaceVTable</span></a> and
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> will be used to call into the interface vtable for processing
the request.
</p>
<p>
All calls into user-provided code will be invoked in the <GTKDOCLINK HREF="g-main-context-push-thread-default">thread-default main
loop</GTKDOCLINK> of the thread you are calling this method from.
</p>
<p>
If an existing subtree is already registered at <em class="parameter"><code>object_path</code></em> or
then <em class="parameter"><code>error</code></em> is set to <a class="link" href="gio-GIOError.html#G-IO-ERROR-EXISTS:CAPS"><span class="type">G_IO_ERROR_EXISTS</span></a>.
</p>
<p>
Note that it is valid to register regular objects (using
<a class="link" href="GDBusConnection.html#g-dbus-connection-register-object" title="g_dbus_connection_register_object ()"><code class="function">g_dbus_connection_register_object()</code></a>) in a subtree registered with
<a class="link" href="GDBusConnection.html#g-dbus-connection-register-subtree" title="g_dbus_connection_register_subtree ()"><code class="function">g_dbus_connection_register_subtree()</code></a> - if so, the subtree handler
is tried as the last resort. One way to think about a subtree
handler is to consider it a <span class="quote">“<span class="quote">fallback handler</span>”</span>
for object paths not registered via <a class="link" href="GDBusConnection.html#g-dbus-connection-register-object" title="g_dbus_connection_register_object ()"><code class="function">g_dbus_connection_register_object()</code></a>
or other bindings.
</p>
<p>
Note that <em class="parameter"><code>vtable</code></em> will be copied so you cannot change it after
registration.
</p>
<p>
See <a class="xref" href="GDBusConnection.html#gdbus-subtree-server" title="Example 3. D-Bus subtree example">Example 3, “D-Bus subtree example”</a> for an example of how to use this method.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>object_path</code></em> :</span></p></td>
<td>The object path to register the subtree at.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>vtable</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html#GDBusSubtreeVTable" title="GDBusSubtreeVTable"><span class="type">GDBusSubtreeVTable</span></a> to enumerate, introspect and dispatch nodes in the subtree.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td>
<td>Flags used to fine tune the behavior of the subtree.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>Data to pass to functions in <em class="parameter"><code>vtable</code></em>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data_free_func</code></em> :</span></p></td>
<td>Function to call when the subtree is unregistered.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Return location for error or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 if <em class="parameter"><code>error</code></em> is set, otherwise a subtree registration id (never 0)
that can be used with <a class="link" href="GDBusConnection.html#g-dbus-connection-unregister-subtree" title="g_dbus_connection_unregister_subtree ()"><code class="function">g_dbus_connection_unregister_subtree()</code></a> .</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="g-dbus-connection-unregister-subtree"></a><h3>g_dbus_connection_unregister_subtree ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_dbus_connection_unregister_subtree
                                                        (<em class="parameter"><code><a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#guint"><span class="type">guint</span></a> registration_id</code></em>);</pre>
<p>
Unregisters a subtree.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>A <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>registration_id</code></em> :</span></p></td>
<td>A subtree registration id obtained from <a class="link" href="GDBusConnection.html#g-dbus-connection-register-subtree" title="g_dbus_connection_register_subtree ()"><code class="function">g_dbus_connection_register_subtree()</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the subtree was unregistered, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
</div>
<div class="refsect1">
<a name="GDBusConnection.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GDBusConnection--address"></a><h3>The <code class="literal">"address"</code> property</h3>
<pre class="programlisting">  "address"                  <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Write / Construct Only</pre>
<p>
A D-Bus address specifying potential endpoints that can be used
when establishing the connection.
</p>
<p>Default value: NULL</p>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusConnection--authentication-observer"></a><h3>The <code class="literal">"authentication-observer"</code> property</h3>
<pre class="programlisting">  "authentication-observer"  <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a>*    : Write / Construct Only</pre>
<p>
A <a class="link" href="GDBusAuthObserver.html" title="GDBusAuthObserver"><span class="type">GDBusAuthObserver</span></a> object to assist in the authentication process or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
</p>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusConnection--capabilities"></a><h3>The <code class="literal">"capabilities"</code> property</h3>
<pre class="programlisting">  "capabilities"             <a class="link" href="GDBusConnection.html#GDBusCapabilityFlags"><span class="type">GDBusCapabilityFlags</span></a>  : Read</pre>
<p>
Flags from the <a class="link" href="GDBusConnection.html#GDBusCapabilityFlags"><span class="type">GDBusCapabilityFlags</span></a> enumeration
representing connection features negotiated with the other peer.
</p>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusConnection--closed"></a><h3>The <code class="literal">"closed"</code> property</h3>
<pre class="programlisting">  "closed"                   <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read</pre>
<p>
A boolean specifying whether the connection has been closed.
</p>
<p>Default value: FALSE</p>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusConnection--exit-on-close"></a><h3>The <code class="literal">"exit-on-close"</code> property</h3>
<pre class="programlisting">  "exit-on-close"            <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
<p>
A boolean specifying whether the process will be terminated (by
calling <code class="literal">raise(SIGTERM)</code>) if the connection
is closed by the remote peer.
</p>
<p>Default value: FALSE</p>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusConnection--flags"></a><h3>The <code class="literal">"flags"</code> property</h3>
<pre class="programlisting">  "flags"                    <a class="link" href="GDBusConnection.html#GDBusConnectionFlags"><span class="type">GDBusConnectionFlags</span></a>  : Write / Construct Only</pre>
<p>
Flags from the <a class="link" href="GDBusConnection.html#GDBusConnectionFlags"><span class="type">GDBusConnectionFlags</span></a> enumeration.
</p>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusConnection--guid"></a><h3>The <code class="literal">"guid"</code> property</h3>
<pre class="programlisting">  "guid"                     <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read / Write / Construct Only</pre>
<p>
The GUID of the peer performing the role of server when
authenticating.
</p>
<p>
If you are constructing a <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> and pass
<a class="link" href="GDBusConnection.html#G-DBUS-CONNECTION-FLAGS-AUTHENTICATION-SERVER:CAPS"><code class="literal">G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER</code></a> in the
<a class="link" href="GDBusConnection.html#GDBusConnection--flags" title='The "flags" property'><span class="type">"flags"</span></a> property then you MUST also set this
property to a valid guid.
</p>
<p>
If you are constructing a <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> and pass
<a class="link" href="GDBusConnection.html#G-DBUS-CONNECTION-FLAGS-AUTHENTICATION-CLIENT:CAPS"><code class="literal">G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT</code></a> in the
<a class="link" href="GDBusConnection.html#GDBusConnection--flags" title='The "flags" property'><span class="type">"flags"</span></a> property you will be able to read the GUID
of the other peer here after the connection has been successfully
initialized.
</p>
<p>Default value: NULL</p>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusConnection--stream"></a><h3>The <code class="literal">"stream"</code> property</h3>
<pre class="programlisting">  "stream"                   <a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a>*            : Read / Write / Construct Only</pre>
<p>
The underlying <a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a> used for I/O.
</p>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="GDBusConnection--unique-name"></a><h3>The <code class="literal">"unique-name"</code> property</h3>
<pre class="programlisting">  "unique-name"              <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read</pre>
<p>
The unique name as assigned by the message bus or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the
connection is not open or not a message bus connection.
</p>
<p>Default value: NULL</p>
<p class="since">Since 2.26</p>
</div>
</div>
<div class="refsect1">
<a name="GDBusConnection.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="GDBusConnection-closed"></a><h3>The <code class="literal">"closed"</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                user_function                      (<a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> *connection,
                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>         remote_peer_vanished,
                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>          *error,
                                                        <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>         user_data)                 : <a href="http://library.gnome.org/devel/gobject/unstable/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre>
<p>
Emitted when the connection is closed.
</p>
<p>
The cause of this event can be
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
   If <a class="link" href="GDBusConnection.html#g-dbus-connection-close" title="g_dbus_connection_close ()"><code class="function">g_dbus_connection_close()</code></a> is called. In this case
   <em class="parameter"><code>remote_peer_vanished</code></em> is set to <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> and <em class="parameter"><code>error</code></em> is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
</p></li>
<li class="listitem"><p>
   If the remote peer closes the connection. In this case
   <em class="parameter"><code>remote_peer_vanished</code></em> is set to <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> and <em class="parameter"><code>error</code></em> is set.
</p></li>
<li class="listitem"><p>
   If the remote peer sends invalid or malformed data. In this
   case <em class="parameter"><code>remote_peer_vanished</code></em> is set to <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> and <em class="parameter"><code>error</code></em>
   is set.
</p></li>
</ul></div>
<p>
</p>
<p>
Upon receiving this signal, you should give up your reference to
<em class="parameter"><code>connection</code></em>. You are guaranteed that this signal is emitted only
once.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>connection</code></em> :</span></p></td>
<td>The <a class="link" href="GDBusConnection.html" title="GDBusConnection"><span class="type">GDBusConnection</span></a> emitting the signal.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>remote_peer_vanished</code></em> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>connection</code></em> is closed because the
remote peer closed its end of the connection.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>A <a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> with more details about the event or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>